I need to make use of numbers coming from another system that are 128-bit (quadruple-precision) floating point numbers in java.
Considering that there is no equivalent type in java, I would like to reduce the precision of the numbers using java code so they can be stored in a java double. This can be done fairly easily in c or using assembly but I would like to do it purely in java.
It is fair to assume that the quadruple-precision number is stored in a 128-bit byte array in java.
Is there a good solution, using only java? Thanks.
BigDecimal
might work for you. – Composelong
, and useDouble.longBitsToDouble
to produce yourdouble
result. (It should be possible to transliterate the C algorithm into Java with a bit of work.) – Iguanodon