[ Arithmetic | Reference Manual | Alphabetic Index ]

breal_from_bounds(+Lo, +Hi, -Result)

Constructs a bounded real from the given floating point bounds
Lo
A number.
Hi
A number.
Result
Output: bounded real number.

Description

This predicate is used by the ECLiPSe compiler to expand evaluable arithmetic expressions. So a call to breal_from_bounds(Lo, Hi, Result) is equivalent to
    Result is breal_from_bounds(Lo, Hi).
This predicate constructs a new bounded real number with the specified bounds. In effect, the bounds are first cast to bounded reals, and then the new bounded real is constructed from the lower bound of Lo and the upper bound of Hi.

Modes and Determinism

Exceptions

(4) instantiation fault
Lo or Hi are not instantiated.
(20) arithmetic exception
The lower bound of Lo is greater than the upper bound of Hi.
(24) number expected
Lo or Hi are not numbers.

Examples

Success:
      ?- breal_from_bounds(0.99, 1.01, X).
      X = 0.99__1.01

      ?- breal_from_bounds(1_3, 2_3, X).
      X = 0.33333333333333326__0.66666666666666674

Error:
      ?- breal_from_bounds(1, H, X).
      instantiation fault in breal_from_bounds(1, H, X)

      ?- breal_from_bounds("a", 2.0, X).
      number expected in breal_from_bounds("a", 2.0, X)

      ?- breal_from_bounds(2 + 4, 3 + 5, Z).
      number expected in breal_from_bounds(2 + 4, 3 + 5, Z)

      ?- breal_from_bounds(1.0, 2.0, 1.0__2.0).
      type error in breal_from_bounds(1.0, 2.0, 1.0__2.0)

      ?- breal_from_bounds(1.1, 0.9, X).
      arithmetic exception in breal_from_bounds(1.1, 0.9, X)

See Also

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