note 67187 added to language.operators.arithmetic
| From: | andr3a at 3site dot it | Date: | Mon, 05 Jun 2006 11:55:32 +0000 |
| Subject: | note 67187 added to language.operators.arithmetic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-113237@lists.php.net to get a copy of this message | ||
just a note about module operator, remember that it works correctly only with integers.
<?php
$a = pow(2, 31); // integer N limit on 32 bit based systems
$b = $a / 2;
echo implode('<br />', array(
$a + $b, // OK => 3221225472
$a - $b, // OK => 1073741824
$a * $b, // OK => 2.3058430092137E+018
$a / $b, // OK => 2
$a % $b // ??? => 0
));
?>
maybe bc_mod should works correctly with (string) casted double
bc_mod((string)pow(2, 31), pow(2, 31)/2);
----
Server IP: 80.241.173.254
Probable Submitter: 80.116.51.243
----
X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.operators.arithmetic.php
Edit -- http://master.php.net/note/edit/67187
Del: integrated -- http://master.php.net/note/delete/67187/integrated
Del: useless -- http://master.php.net/note/delete/67187/useless
Del: bad code -- http://master.php.net/note/delete/67187/bad+code
Del: spam -- http://master.php.net/note/delete/67187/spam
Del: non-english -- http://master.php.net/note/delete/67187/non-english
Del: in docs -- http://master.php.net/note/delete/67187/in+docs
Del: other reasons-- http://master.php.net/note/delete/67187
Reject -- http://master.php.net/note/reject/67187
Search -- http://master.php.net/manage/user-notes.php