close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 20 years ago

Closed 18 years ago

Last modified 18 years ago

#187 closed defect (fixed)

Some errors with "Range" function

Reported by: imendez Owned by: Víctor de Buen Remiro
Priority: normal Milestone:
Component: SetAlgebra Version: 1.1.1
Severity: normal Keywords:
Cc: Alfredo Torre

Description

Code:

/
Set s01 = Range(0.85, 0.96, 0.01);
Set s02 = Range(0.5, 0.999, 0.001);
Set s03 = s02 - s01;
Set s04 = s01*s03;
/

Errors:

  • 0.96 doesn't belong to s01
  • 0.91 and 0.85 are in s03 and shouldn't be in.
  • s04 is empty, and the intersection of s01 and s03 is, due to the former error:

s04 == 0.91, 0.85 ?, so here appears to do well the substract (s02 - s01)

Regards

Change History (10)

comment:1 Changed 20 years ago by Jorge

Owner: changed from danirus to Jorge

i will take care of this

comment:2 Changed 20 years ago by Jorge

Status: newassigned

This

comment:3 Changed 20 years ago by Jorge

Resolution: fixed
Status: assignedclosed

That bug is fixed. But it's worth makimg notes about. First of all just remember that,
due to internal binary representation & finite, most of the real numbers can not be
represented exactly. Also the floating point operations introduce some rounding
error.

In the sample code provided in this report nither 0.85 nor 0.96 could be exactly
represented in binary rep.

0.85 is represented aprox. as 0.84999999999999998
0.96 is represented aprox. as 0.95999999999999996

This way we (referring to TDT) should be carefully when dealing with real
numbers specially when converting to integers values and comparing.

regards.

comment:4 Changed 20 years ago by imendez

Resolution: fixed
Status: closedreopened

I think this bug is not completly resolved.
Tested on version from 2005/01/13, the second error:

  • 0.91 and 0.85 are in s03 and shouldn't be in.

goes on ocurring.

Regards.

comment:5 Changed 19 years ago by Jorge

Resolution: fixed
Status: reopenedclosed

must be tested on windows!

on linux the code provided succeed.

comment:6 Changed 19 years ago by imendez

Cc: Alfredo Torre added
Resolution: fixed
Status: closedreopened

Yes, I reported this bug specifying that the OS is Windows2000. Could someone
test it in Windows, please?

Regards

comment:7 Changed 19 years ago by Jorge

Ivan, in Linux, before the fix, I obtained the same results that raised this
bug reports. After the fix I obtained the correct results, it only remains
checking it on windows.

comment:8 Changed 18 years ago by Víctor de Buen Remiro

Owner: changed from Jorge to Víctor de Buen Remiro
Status: reopenednew

comment:9 Changed 18 years ago by Víctor de Buen Remiro

Resolution: fixed
Status: newclosed

Bug has been fixed in CVS a few weeks ago
A new test tol_tests/tol/Bugzilla/bug_000187 has been added
Thanks to report it

comment:10 Changed 18 years ago by Víctor de Buen Remiro

bug_file_loc: http://cvs.tol-project.org/viewcvs.cgi/tol_tests/tol/Bugzilla/bug_000187
Note: See TracTickets for help on using tickets.