Re: ffi.cast: weird behaviour

  • From: Mike Pall <mike-1311@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 21 Nov 2013 13:34:51 +0100

Daurnimator wrote:
> The alternative is to check that the string does not contain an invalid NaN
> upfront: what would this look like?

You check the bit pattern for (any) NaN and always return the
canonical NaN. The proper check is: exponent is all '1', mantissa
non-zero, sign ignored.

--Mike

Other related posts: