On Friday, 27 May 2016 at 15:49:16 UTC, ArturG wrote:
On Friday, 27 May 2016 at 15:24:18 UTC, Adam D. Ruppe wrote:
On Friday, 27 May 2016 at 15:19:50 UTC, ArturG wrote:
yes but i have to check for that when some one does

Why? This is no different than if they set any of the other four billion possible values.

What do you mean?

operation on float.nan gives you a float.nan so why does the shortcut evaluate to true and not false wouldnt that make more sense?

NaN in IEEE 754 floating-point numbers (the floating-point number system most languages and processors use) is defined as a number with all exponent bits set and a non-zero mantissa. The mantissa value is the "NaN payload", and can be any value.

`is` does a binary comparison on floating-point numbers, so NaNs with different payloads will not be considered equal, as you have found out with `float.init !is float.nan`.

Reply via email to