note 67187 deleted from language.operators.arithmetic by betz
| From: | betz@php.net | Date: | Mon, 05 Jun 2006 17:51:54 +0000 |
| Subject: | note 67187 deleted from language.operators.arithmetic by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-113253@lists.php.net to get a copy of this message | ||
Note Submitter: andr3a at 3site dot it
----
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);