fp-bitwise= ( x y -- ? ) (original) (raw)

Vocabulary
math

Inputs

Outputs

Word description
Compares two floating point numbers for bit equality.

Notes
Unlike = or number=, this word will consider NaNs with equal payloads to be equal, and positive zero and negative zero to be not equal.

Examples
Not-a-number equality:

USING: kernel math prettyprint ; 0.0 0.0 / dup number= .
f

USING: kernel math prettyprint ; 0.0 0.0 / dup fp-bitwise= .
t

Signed zero equality:

USING: math prettyprint ; -0.0 0.0 fp-bitwise= .
f

USING: math prettyprint ; -0.0 0.0 number= .
t

Definition