note 18223 added to language.types.integer
| From: | tim at freeman dot little-possums dot net dot invalid | Date: | Tue, 15 Jan 2002 05:20:04 +0000 |
| Subject: | note 18223 added to language.types.integer | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-24829@lists.php.net to get a copy of this message | ||
> there is no risk of rounding errors when doing (int)(n1/n2).
This is not quite true. Although both n1 and n2 can be represented exactly in a float, their
quotient often cannot be. It is not even guaranteed that for floating-point arithmetic,
6.0/3.0==2.0 exactly. The floating-point answer may be 1.999...etc, which would round down to 1.
--
http://www.php.net/manual/en/language.types.integer.php
http://master.php.net/manage/user-notes.php?action=edit+18223
http://master.php.net/manage/user-notes.php?action=delete+18223
http://master.php.net/manage/user-notes.php?action=reject+18223