Generating equally-spaced floats with least rounding error

Chris Angelico rosuav at gmail.com
Sat Sep 24 15:58:32 CEST 2011


On Sat, Sep 24, 2011 at 11:53 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> #1 add multiples of the width to the starting value, 0.
>
> #2 subtract multiples of width from the ending value, 2.1.

#3, go half and half - generate the lower half by adding to the lower
bound, and the upper half by subtracting from the upper bound. Not
sure if it'll help or not but it might be worth a shot.

ChrisA



More information about the Python-list mailing list