[ Arithmetic | Reference Manual | Alphabetic Index ]

breal_bounds(+Number, -Min, -Max)

Extracts lower and upper floating point bounds of Number
Number
A number.
Min
Output: float.
Max
Output: float.

Description

A bounded real is a real number represented by a lower and upper bound in floating point format. This predicate extracts both bounds and unifies them with Min and Max respectively. If Number is not a bounded real, the result returned is equivalent to converting it to a bounded real first.

Modes and Determinism

Exceptions

(4) instantiation fault
Number is not instantiated
(24) number expected
Number is a not a number.

Examples

Success:
    ?- breal_bounds(0.99__1.01, Min, Max).
    Min = 0.99
    Max = 1.01

    ?- breal(1.0, One), breal_bounds(One, Min, Max).
    One = 1.0__1.0
    Min = 1.0
    Max = 1.0

    ?- breal(1, One), breal_bounds(One, Min, Max).
    One = 1.0__1.0
    Min = 1.0
    Max = 1.0

    ?- breal_bounds(1, Min, Max).
    Min = 1.0
    Max = 1.0

    ?- breal_bounds(1.0, Min, Max).
    Min = 1.0
    Max = 1.0

    ?- breal_bounds(1_10, Min, Max).
    Min = 0.099999999999999992
    Max = 0.10000000000000002

Error:
    ?- breal_bounds("a", Min, Max).
    number expected in breal_bounds("a", Min, Max)

    ?- breal_bounds(2 + 4, Min, Max).
    number expected in breal_bounds(2 + 4, Min, Max)

See Also

breal / 1, breal / 2, breal_min / 2, breal_max / 2, breal_from_bounds / 3, is / 2