Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Arithmetic Series Objects get wrong precision in some cases

Closed / Fixed578b7e273c03c913a82de4d314f30c883a19615fCreated 3 years agoUpdated 3 years ago
Descriptionmarkdown2024-02-12 18:22:01

I would expect that if the first command below finds the element, the second would also do so. Apparently not.

% expr {2.8 in [lseq 0 count 100 by .1]}
1
% expr {2.8 in [lseq 0 count 200 by .1]}
0
The problem appears to be that cumulative error in the projected forward end value (in turn used to compute the number of values, which we provide) is resulting in the precision being estimated to be 15 instead of 1. Probably ought to have an alternate way of building ArithSeries objects that takes start/count/step instead of start/end/step to avoid the systematic error...

griffinmarkdown2024-02-14 02:00:24

Oops. The intent is to define the precision solely on the provided arguments only, as you've alluded to.

Thanks for reporting this!

griffinplain2024-02-15 16:30:59
Fixed with  855a2f171c
Log in (anonymous is fine) to add a comment.