Bitwise operations on floats
Factor handbook » The language » Numbers » Floats

Prev:/f ( x y -- z )
Next:Floating point comparison operations


Floating point numbers are represented internally in IEEE 754 double-precision format. This internal representation can be accessed for advanced operations and input/output purposes.
float>bits ( x -- n )

double>bits ( x -- n )

bits>float ( n -- x )

bits>double ( n -- x )


Constructing floating point NaNs:
<fp-nan> ( payload -- nan )


Floating point numbers are discrete:
prev-float ( m -- n )

next-float ( m -- n )


Introspection on floating point numbers:
fp-special? ( x -- ? )

fp-nan? ( x -- ? )

fp-qnan? ( x -- ? )

fp-snan? ( x -- ? )

fp-infinity? ( x -- ? )

fp-nan-payload ( x -- bits )


Comparing two floating point numbers for bitwise equality:
fp-bitwise= ( x y -- ? )


See also
NAN: