On 21 November 2013 13:34, Mike Pall <mike-1311@xxxxxxxxxx> wrote: > 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 > Thanks Mike. This is what I ended up with: https://gist.github.com/daurnimator/7582543 Hopefully I didn't overlook anything else...