note 67247 added to language.operators.arithmetic
| From: | bxmATcsd0tnottd0tacd0tuk at osu1 dot php dot net | Date: | Mon, 05 Jun 2006 23:06:41 +0000 |
| Subject: | note 67247 added to language.operators.arithmetic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-113337@lists.php.net to get a copy of this message | ||
An implementation of the classical modulus operator (as in mathematics or Java). An alternative to
the one given below, which was more elegant. This implementation maybe more efficient?
// Computes...
// Mathematics: $a (mod $b)
// Java: $a % $b
function modulus( $a, $b )
{
if( $a < 0 )
{
return $b - ( abs( $a ) % $b );
}
else
{
return $a % $b;
}
}
----
Server IP: 85.116.0.130
Probable Submitter: 83.67.57.153
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.operators.arithmetic.php
Edit -- http://master.php.net/note/edit/67247
Del: integrated -- http://master.php.net/note/delete/67247/integrated
Del: useless -- http://master.php.net/note/delete/67247/useless
Del: bad code -- http://master.php.net/note/delete/67247/bad+code
Del: spam -- http://master.php.net/note/delete/67247/spam
Del: non-english -- http://master.php.net/note/delete/67247/non-english
Del: in docs -- http://master.php.net/note/delete/67247/in+docs
Del: other reasons-- http://master.php.net/note/delete/67247
Reject -- http://master.php.net/note/reject/67247
Search -- http://master.php.net/manage/user-notes.php