users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: reporting bug displaying real numbers


From: McKee, Paul
Subject: RE: reporting bug displaying real numbers
Date: Fri, 15 Jun 2001 02:51:35 -0400

If you look at machine representation of real (floating point) numbers, you
will see that they cannot in many cases be represented precisely. This
applies to any language and is a limitation of the way that we have to store
numbers. Hence, those of us who have been working with these things for a
while, never check for equality of a real but user greater or less than or
check within a range.

Hence I would not call this a bug but a DSP error.

Paul McKee
IS EMEA CPC DBA :
Merck Sharpe & Dohme Europe Inc. 
Tel : (+322)  776.62.61 - Fax : (+322) 776.63.04
Clos du lynx 5, 1200 Brussels


-----Original Message-----
From: Erick Alphonse [mailto:address@hidden
Sent: Thursday, 14 June, 2001 20:41
Cc: address@hidden
Subject: reporting bug displaying real numbers


Hello,

running gprolog-1.2.6 on an athlon-linux, I have the following outputs:

| ?- write(1.0).
1.0

yes
| ?- write(1.1).
1.1000000000000001

yes
| ?- write(1.2).
1.2

yes
| ?- write(1.3).
1.3

yes
| ?- write(1.4).
1.3999999999999999

and

| ?- 1.4 == 1.3999999999999999.

yes

and it will be the same with write/1, writeq/1, write_canonical/1,
display/1 and print/1.

That can be the source of big problems.
Erick.

_______________________________________________
Users-prolog mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/users-prolog



reply via email to

[Prev in Thread] Current Thread [Next in Thread]