[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Floating point
- From: Andrew Sidwell <news@...>
- Date: Thu, 30 Mar 2006 10:06:12 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I'm wondering if anyone knows of a way to make sure a value is only to
two decimal points? I only ask because the obvious solution using
(math.ceil(n * 100) == (n * 100)) doesn't work:
> print(math.floor(3466) == math.floor(34.66 * 100))
false
It would also be quite nice to know why this doesn't work.
Cheers,
Andrew Sidwell
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3rc2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEK5+EnTTdvBpPNwsRAu5SAJ9k2M4GQmFcB+V6hPxiYbZ8DcT3dACg4Ufr
MDFPs4Q9Xf1XFiutl11ys/w=
=n+Yh
-----END PGP SIGNATURE-----