[Python-bugs-list] Inaccuracy of <= to two or more decimal places (PR#351)
ashar@vpharm.com
ashar@vpharm.com
Thu, 8 Jun 2000 18:01:44 -0400 (EDT)
Full_Name: Raj Ashar
Version: 1.5.2
OS: Windows NT 4.0
Submission from: fringe.vpharm.com (208.48.225.2)
Hello. K. Sandretto and I believe we found the "<=" operator functions
like a "<" when incrementing loop variables with numbers smaller than 0.1.
For example:
LoopVariable = 0
Increment = 0.05
while LoopVariable <= 1:
print LoopVariable
LoopVariable = LoopVariable + Increment
prints out 0.95 as the highest value, as the "<" operator would,
rather than printing out 1.0 as well.
When only the Increment was changed to 0.1 in this loop,
the value 1.0 did get printed onscreen. Using the value 0.125
also printed out 1.0, but neither 0.025 nor 0.01 allowed 1.0 to appear
onscreen.
We have been able to also reproduce this result in Python 1.5 on an SGI
running IRIX 6.4, and we appreciate any ideas on this matter.
Raj