[ Arithmetic | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]
breal_bounds(+Number, ?Min, ?Max)
Extracts lower and upper floating point bounds of Number
- Number
- A 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. If Number is not a
bounded real, the result returned is equivalent to converting it to
a bounded real first.
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 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
?- 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).
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