[ Arithmetic | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

breal_bounds(+Number, ?Min, ?Max)

Extracts lower and upper floating point bounds of the bounded real Number
Number
A bounded real number.
Min
A variable or float.
Max
A variable or 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.

Fail Conditions

Fails if Min or Max do not unify with the real's bounds

Resatisfiable

No

Exceptions

(4) instantiation fault
Number is not instantiated
(5) type error
Number is a not a bounded real number.
(5) type error
Min is neither a variable nor a float.
(5) type error
Max is neither a variable nor a float.

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

Error:
    ?- breal_bounds(1, Min, Max).
    type error in breal_bounds(1, Min, Max)

    ?- breal_bounds(1.0, Min, Max).
    type error in breal_bounds(1.0, Min, Max)

    ?- breal_bounds("a", Min, Max).
    type error in breal_bounds("a", Min, Max)

    ?- breal_bounds(2 + 4, Min, Max).
    type error 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