0

I want to convert double precision numbers to decimal .

for example I have 23.43, the double value would be (using matlab) : 174 71 255 122 20 110 55 64 now having this how can I write a java program that gives me 23.43 ?

and here is the calculation of double precision in matlab :

MATLAB constructs the double data type according to IEEE Standard 754 for double precision. Any value stored as a double requires 64 bits, formatted as shown in the table below:

Bits Usage

63 Sign (0 = positive, 1 = negative)

62 to 52 Exponent, biased by 1023

51 to 0 Fraction f of the number 1.f

melisa zand
  • 211
  • 2
  • 6
  • 16

1 Answers1

5
long l = Double.doubleToLongBits(double);
double d = Double.longBitsToDouble(long);
Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
Liu guanghua
  • 981
  • 1
  • 9
  • 18
  • Looks like what you have is a byte array. You'll need to convert your numbers to a long first to use this answer, it shouldn't be complicated. – Haozhun May 24 '12 at 08:12
  • I tried to convert -22 now I recieve 4.668931E18 , first i convert byte to long and then double to long but what is this number ? – melisa zand Jun 01 '12 at 10:37