[ Arithmetic | Reference Manual | Alphabetic Index ]

breal(+Number, -Result)

Converts Number into a breal number and unifies it with Result.
Number
A number.
Result
Output: bounded real number.

Description

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

Modes and Determinism

Exceptions

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

Examples

    % integers and floats are assumed to be accurate:
    Result is breal(25).	% gives Result = 25.0__25.0
    Result is breal(1.5).	% gives Result = 1.5__1.5

    % rationals are conservatively rounded:
    Result is breal(3_4).	% gives Result = 0.74999999999999989__0.75000000000000011

    % identity
    Result is breal(1.0__1.01).	% gives Result = 1.0__1.01

See Also

integer / 2, float / 2, rational / 2, is / 2, breal_min / 2, breal_max / 2, breal_bounds / 3, breal_from_bounds / 3, breal / 1