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 21 years ago

Closed 21 years ago

Last modified 18 years ago

#143 closed defect (fixed)

Range Doesn`t work properly

Reported by: asalafranca Owned by: manuelb
Priority: high Milestone:
Component: Math Version: head
Severity: blocker Keywords:
Cc:

Description

We I run this

Set s = Range(1.01, 1.02, 0.01);

Tol returns
1.01
1.02
1.03

Which has an extra element!!

Change History (4)

comment:1 Changed 21 years ago by manuelb

Owner: changed from danirus to manuelb

comment:2 Changed 21 years ago by manuelb

Status: newassigned

comment:3 Changed 21 years ago by manuelb

Resolution: fixed
Status: assignedclosed

A Ceil call using the result of the next operation as argument was done:
(until-from)/pass
Which, as a floating-point operation, under some circumstances can round X to get
a X.0000000000009 value. Therefore, the above operation would be rounded up to
(X+1) when using non-integer operators.
Using Abs() solves the problem.

A fix for it is already on the cvs.

Also, I have included some tests to check this behaviour in the future.

comment:4 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_000143
Note: See TracTickets for help on using tickets.