<div dir="ltr">Hmmm.  Yah, 10 ^ -20 cannot be exactly represented in any 2s complement FP format.  So unless there is a requirement that it round up, that result is perfectly valid.<div><br></div><div><div>        long double d;</div><div><br></div><div>        d = pow(10.0, -20.0);</div><div>        printf("%23.23Lg\n", d);</div><div>        d = powl(10.0, -20.0);</div><div>        printf("%23.23Lg\n", d);</div><div><br></div><div><div>apollo:/home/dillon> ./x</div><div>9.9999999999999994515327e-21</div><div>1.0000000000000000000342e-20</div></div><div><br></div><div>It's similar to, say, the problem one might have trying to increment a floating point value by 0.1.  Small errors will build up because '0.1' cannot be exactly represented in 2s complement floating point.</div><div><br></div><div><div>        long double d;</div><div><br></div><div>        for (d = 0.0; d < 1000.0; d = d + 0.1)</div><div>                printf("%23.23Lg\n", d);</div></div><div><br></div><div><div>0.10000000000000000555112</div><div>0.20000000000000001110223</div></div><div>...</div><div><div>999.59999999999992015276</div></div><div><div>...</div><div>999.99999999999992006394</div></div><div><br></div><div>Also, side note: 80-bit floating point is not performance-optimized on Intel CPUs.  The HW doesn't optimize it, the vector instructions don't support it, etc.  So the compiler has to fall-back to older FP stack instructions in order to retain the precision.  You generally want to just use float or double.</div><div><br></div><div>-Matt</div></div><div><br></div></div>