note 18223 deleted from language.types.integer by colder
| From: | colder@php.net | Date: | Tue, 17 Oct 2006 18:52:22 +0000 |
| Subject: | note 18223 deleted from language.types.integer by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118662@lists.php.net to get a copy of this message | ||
Note Submitter: tim at freeman dot little-possums dot net dot invalid
----
> 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.