[ Arithmetic | Reference Manual | Alphabetic Index ]

numerator(+Number, -Result)

Extracts the numerator of the rational Number and unifies the resulting integer with Result.
An integer or rational number.
Output: integer.


This predicate is used by the ECLiPSe compiler to expand evaluable arithmetic expressions. So the call to numerator(Number, Result) is equivalent to
    Result is numerator(Number)
which should be preferred.

In coroutining mode, if Number is uninstantiated, the call to numerator/2 is delayed until this variable is instantiated.

Modes and Determinism


(4) instantiation fault
Number is not instantiated (non-coroutining mode only).
(5) type error
Number is a float or breal.
(24) number expected
Number is not of a numeric type.


    Result is numerator(3_4).		% gives Result = 3
    Result is numerator(9_12).		% gives Result = 3
    Result is numerator(-3_4).		% gives Result = -3
    Result is numerator(25).		% gives Result = 25

    Result is numerator(3.1).           % type error

See Also

is / 2, denominator / 2, rational / 2