09-08-2023, 04:03 PM
Pure Basic has a NAN "function". The trick is to find an especially-encoded 32-bit or 64-bit floating-point value to represent NAN. Find two others to represent positive and negative infinity. Maybe another one to represent the square root of -1. And so on.
FROM:
https://en.wikipedia.org/wiki/NaN#Floating_point
FROM:
https://en.wikipedia.org/wiki/NaN#Floating_point
Quote:IEEE 754 NaNs are encoded with the exponent field filled with ones (like infinity values), and some non-zero number in the significand field (to make them distinct from infinity values); this allows the definition of multiple distinct NaN values, depending on which bits are set in the significand field, but also on the value of the leading sign bit (but applications are not required to provide distinct semantics for those distinct NaN values).
For example, an IEEE 754 single precision (32-bit) NaN would be encoded as
s111 1111 1xxx xxxx xxxx xxxx xxxx xxxx
where s is the sign (most often ignored in applications) and the x sequence represents a non-zero number (the value zero encodes infinities). In practice, the most significant bit from x is used to determine the type of NaN: "quiet NaN" or "signaling NaN" (see details in Encoding). The remaining bits encode a payload (most often ignored in applications).