lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 12/10/2011 12:20 AM, Roberto Ierusalimschy wrote:
and the simple tests:

  print(2^3 - 8)
  print(3^4 - 81)

These all should be zero. It really seems that the 'pow' function
from the C library is broken.

Correction to my previous post, usage of 2 ** (y log2(x)) for x86 may not be the real reason. For one, the value I got (-2.84217e-014) had the wrong sign, and secondly, for 2^3-8, the calculation is exact.

FWIW, for the result -2.84217e-014, the IEEE754 double byte value of the 81-something value versus the normally expected result is:

0x40543FFFFFFFFFFF => short of -2.84217e-014
0x4054400000000000 => 81 exact

so Tymur's result should be off by 1 in the other direction,

Sorry for the noise. But a non-exact value for 2^3-8 seems pretty bad for business, though...

Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia