note 3051 deleted from Floating point numbers by jeroen
| From: | jeroen@php.net | Date: | Wed, 23 May 2001 23:14:49 +0000 |
| Subject: | note 3051 deleted from Floating point numbers by jeroen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14216@lists.php.net to get a copy of this message | ||
pseudo-code (I'm still learning PHP),
<PRE>
# returns largest multiple of b which is less then or equal to a.
# Effectively this is integer division ported to floats.
# ie. a / b.
float div (float a, float b) {
return (b * truncate(a / b));
}
</PRE>
Note that truncate *truncates*, it doesn't mean *round*.
/ here is normal floating point division.