# Re: [eclipse-users] declaring constants

From: Stefano Novello \(snovello\) <"Stefano>
Date: Fri, 15 Jun 2007 11:27:14 -0400
```Hello Nicolas,
ECLiPse represents the bounded real data type as a pair of floating
point numbers. The numbers use a 64 bit representation.

So you can represent many integers with full accuracy (but the synax
requires you to write something like 123.0__456.0. Eventually though you
lose precision.

A = 123456789123456789123456789.0__9123456789123456789123456789.0 .
Yes
A = 1.2345678912345679e+26__9.123456789123457e+27

Please also look at the docs. In the user manual arithmetic (bounded
reals) section as well as man page for is/2.

I mention the documentation because the bounded reals are quite tricky
to use sometimes.

For example.
?- A = 10.0__12.0, A =:= 11.0, A =:= 11.1.
A = 10.0__12.0
There are 2 delayed goals.
Yes (0.00s cpu)
Stefano

The two =:=/2 goals are checked individually, but they don't fully
succeed. Instead they leave a delayed (i.e. unproven) goal because their
conjunction may be false, which is the case here.

So a goal with a bounded real should succeed if its true for all values
in the range, should fail if it is false for all values, and otherwise
should leave a delayed goal, which may be ground as in the example
above.

Bounded reals were introduced with ic, because ic allows for non integer
coefficients, and can deduce non integer bounds, but when you have that
you need an explicit representation of the uncertainty that comes from
floating point error. They have a few uses such as when you need to
represent a physical measurement in a constraint model, and that
measurement has an small tolerance associated. Then the model will only
make deductions that are true for all values within the tolerance range.

Stefano

> -----Original Message-----
> From:
> eclipse-users-bounces+snovello=cisco.com_at_...2...
> [mailto:eclipse-users-bounces+snovello=cisco.com_at_...64...
> om] On Behalf Of Nicolas BERGER
> Sent: Friday, June 15, 2007 3:05 PM
> To: eclipse-users_at_...2...
> Subject: Re: [eclipse-users] declaring constants
>
> > Hello Nicolas,
> > What you may want is a constant that is in a range, but you
> don't know
> it's value.
> >
> >
> > In ECLiPSe
> >
> > D = 1.99__2.00, X is 1+D.
> > ?- D = 1.99__2.0, X is 1 + D.
> > D = 1.99__2.0
> > X = 2.9899999999999998__3.0
> > Yes (0.00s cpu)
> >
> > When you use maths (is/2) or lib(ic) this range will be taken into
> account in the computation.
> >
> > D in this case is a ground value that will never change. Its not a
> variable at all.
> >
>
>
> Fine !! It works indeed... with floating bounds. But what
> about integer intervals ? e.g. D = 1__4, X #> D
>
>
> Nicolas
>
>
>
>
>
>
> _______________________________________________
> ECLiPSe-Users mailing list
> ECLiPSe-Users_at_...2...
> http://www.crosscoreop.com/mailman/listinfo/eclipse-users
>
```
Received on Fri Jun 15 2007 - 16:28:05 CEST

This archive was generated by hypermail 2.3.0 : Wed Aug 21 2019 - 09:13:31 CEST