Floating point accuracy again

Yesterday I asked a question about why I was losing precision in floating point arithmetic. I got an answer about how this happened due to the fact that the intermediate results are held in the x87 register. It was useful, but some details still elude me. Here's a variant of the program presented in the previous question, I am using VC ++ 2010 Express in debug mode.

int main()
{
    double x = 1.8939201459282359e-308; /* subnormal number */
    double tiny = 4.9406564584124654e-324; /* smallest IEEE double */
    double scale = 1.6;
    double temp = scale*tiny;
    printf("%23.16e\n", x + temp);
    printf("%23.16e\n", x + scale*tiny);
}

Displays

1.8939201459282369e-308
1.8939201459282364e-308

IEEE. scale 2.0 . , temp . , scale*tiny x87, , , temp. , x . , , ? - " "?

, , .

+5
1

, - x87.

IEEE754

x    = 0.d9e66553db96f × 2^(-1022)
tiny = 0.0000000000001 × 2^(-1022)

x87,

x    = 1.b3cccaa7b72de × 2^(-1023)
tiny = 1.0000000000000 × 2^(-1074)

, 1.6*tiny IEEE754, 0.0000000000002 × 2^(-1022), . x

  0.d9e66553db96f × 2^(-1022)
+ 0.0000000000002 × 2^(-1022)
-----------------------------
  0.d9e66553db971 × 2^(-1022)

x87 1.6*tiny

1.999999999999a × 2^(-1074)

  1.b3cccaa7b72de × 2^(-1023)
+ 0.0000000000003333333333334 × 2^(-1023)
-----------------------------------------
  1.b3cccaa7b72e1333333333334 × 2^(-1023)

53

  1.b3cccaa7b72e1 × 2^(-1023)

1. IEEE754 ( 52 , ), 0.d9e66553db970 × 2^(-1022) 0.d9e66553db971 × 2^(-1022) .

, FPU 53 , 64 x87, IEEE754 0.d9e66553db971 × 2^(-1022) , , .

, x87 , INE754- , IEEE754, . , x87, IEEE754.

+7

All Articles