number= ( x y -- ? )
Factor documentation > Factor handbook > The language > Numbers > Arithmetic > Number protocol
Prev:>= ( x y -- ? )


Vocabulary
math

Inputs and outputs
xa number
ya number
?a boolean


Word description
Tests if two numbers have the same numeric value.

Notes
This word differs from = in that it disregards differences in type when comparing numbers.

This word performs an unordered comparison on floating point numbers. See Floating point comparison operations for an explanation.

Examples
USING: math prettyprint ; 3.0 3 number= .
t

USING: kernel math prettyprint ; 3.0 3 = .
f


Definition
IN: math

MATH: number= ( x y -- ? ) foldable flushable


Methods
USING: math math.private ;

M: bignum number= bignum= ; inline


USING: math math.complex.private ;

M: complex number= [ number= ] complex= ; inline


USING: kernel math ;

M: fixnum number= eq? ; inline


USING: math math.private ;

M: float number= float= ; inline


USING: kernel math ;

M: object number= 2drop f ;


USING: kernel math math.ratios ;

M: ratio number=
2>fraction number= [ number= ] [ 2drop f ] if ;