Rational numbers represent exact
quantities. On the other hand, a floating point number is an approximate
value. While rationals can grow to any required precision, floating point numbers have limited precision, and manipulating them is usually faster than manipulating ratios or bignums.
Introducing a floating point number in a computation forces the result to be expressed in floating point.
5/4 1/2 + .
5/4 0.5 + .
Floating point literal syntax is documented in Float syntax
Integers and rationals can be converted to floats:
>float ( x -- y )
Two real numbers can be divided yielding a float result:
/f ( x y -- z ) Bitwise operations on floats Floating point comparison operations
vocabulary provides functionality for controlling floating point exceptions, rounding modes, and denormal behavior.