Java BigDecimal uses hardware architecture as a long double in C ++?

As I understand it, long double in C ++ actually uses hardware architecture (at least for some architectures). Does BigDecimal in Java do enough for small resources?

+4
source share
3 answers

Does BigDecimal in Java do enough for small resources?

, . , BigDecimal . " ", , BigDecimal, , .

, BigDecimal , , . , .


, , Java long double, , , , JDK .

+5

. BigDecimal . . , BigDecimal Java.

BigDecimal(BigInteger intVal, long val, int scale, int prec) {
    this.scale = scale;
    this.precision = prec;
    this.intCompact = val;
    this.intVal = intVal;
}
+1

BigDecimal - .

BigDecimal , . IEEE, , .

, , , , BigDecimal . , 1 10 . 1 10 BigDecimal 1, radix 2.

, , . 1/3. BigDecimal , . BigDecimal.

Running tests for each calculation to determine whether the two formats will receive the same answer will disrupt any performance increase when using hardware support.

+1
source

Source: https://habr.com/ru/post/1652236/


All Articles