#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
Owner: | changed from danirus to Jorge |
---|
comment:3 Changed 20 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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
Resolution: | fixed |
---|---|
Status: | closed → reopened |
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
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
must be tested on windows!
on linux the code provided succeed.
comment:6 Changed 19 years ago by
Cc: | Alfredo Torre added |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
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
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
Owner: | changed from Jorge to Víctor de Buen Remiro |
---|---|
Status: | reopened → new |
comment:9 Changed 18 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
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
bug_file_loc: | → http://cvs.tol-project.org/viewcvs.cgi/tol_tests/tol/Bugzilla/bug_000187 |
---|
i will take care of this