code not true?

Grant Edwards nobody at nowhere.nohow
Sat Apr 22 09:47:24 EDT 2000


On Sat, 22 Apr 2000 14:27:57 +0100, ng at hardlight.couk.com <ng at hardlight.couk.com> wrote:
>interestingly enough on both Win32 and Linux

>>>> (0.7 * 10) == (0.07 * 100)
>0
>
>>>>  (0.07 * 10) == (0.007 * 100)
>1
>
>>>> (0.07 * 100) == (0.007 * 1000)
>0
>
>>>> (0.07 * 1000.0) == (0.007 * 10000.0)
>1

You've proven once again that testing floating point numbers
for equality is not a particularly useful operation.  ;)

This seems to be something that we were all told as freshmen
but stumble over later anyway.  One wonders if a safe language
intended for use by beginners should even have an equality
operator for floating point objects.

-- 
Grant Edwards                   grante             Yow!  Now KEN is having
                                  at               a MENTAL CRISIS beacuse
                               visi.com            his "R.V." PAYMENTS are
                                                   OVER-DUE!!



More information about the Python-list mailing list