note 83631 added to language.operators.arithmetic
| From: | TheWanderer at osu1 dot php dot net | Date: | Thu, 05 Jun 2008 10:52:03 +0000 |
| Subject: | note 83631 added to language.operators.arithmetic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140139@lists.php.net to get a copy of this message | ||
It is worth noticing that when working with large numbers, most noticably using the modulo operator,
the results depend on your CPU architecture. Therefore, running a decent 64-bit machine will be to
your advantage in case you have to perform complex mathematical operations. Here is some example
code - you can compare its output on x86 and x86_64 machines:
<?php
/* tested under PHP 5.2.6-1 with Suhosin-Patch 0.9.6.2 (cli) on both i386 and amd64, Debian
lenny/sid */
$a = 2863311530;
$b = 256;
$c = $a % $b;
echo "$c <br />\n";
echo (2863311530 % 256)." <br />\n"; /* directly with no variables, just to be sure
*/
?>
The code is expected to produce '170' if working correctly (try it in spreadsheet
software).
----
Server IP: 82.177.164.100
Probable Submitter: 89.78.254.113
----
Manual Page -- http://www.php.net/manual/en/language.operators.arithmetic.php
Edit -- https://master.php.net/note/edit/83631
Del: integrated -- https://master.php.net/note/delete/83631/integrated
Del: useless -- https://master.php.net/note/delete/83631/useless
Del: bad code -- https://master.php.net/note/delete/83631/bad+code
Del: spam -- https://master.php.net/note/delete/83631/spam
Del: non-english -- https://master.php.net/note/delete/83631/non-english
Del: in docs -- https://master.php.net/note/delete/83631/in+docs
Del: other reasons-- https://master.php.net/note/delete/83631
Reject -- https://master.php.net/note/reject/83631
Search -- https://master.php.net/manage/user-notes.php