Tim Peters added the comment:
You can use the comparison, provided you understand what it does, and that it
does NOT do what you hoped it would do. Here:
>>> 1.6 - 1.0
0.60009
That shows quite clearly that subtracting 1 from the binary approximation to
1.6 does not leave exactly
pedro flores added the comment:
kk, then i cannot use this comparison?, and this not happen
with8.6-8>0.6 this is false, according to python.
2010/1/14 Mark Dickinson
>
> Mark Dickinson added the comment:
>
> This is not a bug: Python, like many other computer languages, stores
> floats
Mark Dickinson added the comment:
This is not a bug: Python, like many other computer languages, stores floats
in binary. The values 1.6 and 0.6 aren't exactly representable in the internal
format used, so the stored versions of 1.6 and 0.6 are actually just very close
approximations to tho
New submission from pedro flores :
this simple comparison (1.6-1.0)>0.6 , python answer TRUE, and that isnt true.
--
components: Windows
files: bug.py
messages: 97785
nosy: DhaReaL
severity: normal
status: open
title: Math calculation problem (1.6-1.0)>0.6, python said TRUE
type: behavio