note 23037 added to ref.bc
| From: | benjcarson@php.net | Date: | Sun, 07 Jul 2002 20:17:27 +0000 |
| Subject: | note 23037 added to ref.bc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-32715@lists.php.net to get a copy of this message | ||
Note that bcmath doesn't seem to handle numbers in exponential notation (i.e. "1e4"),
although PHP considers such a value a number.
example:
$exp1 = "1E5";
$exp2 = "2E4";
$ans1 = bcadd($exp1, $exp2, 3);
$ans2 = $exp1 + exp2;
echo("bcadd: $exp1 + $exp2 = $ans1");
echo("php: $exp1 + $exp2 = $ans2");
// Output:
bcadd: 1E5 + 2E4 = 0.000
php: 1E5 + 2E4 = 120000
Just a gotcha if you're using passing PHP numbers into bcmath functions...
--
http://www.php.net/manual/en/ref.bc.php
http://master.php.net/manage/user-notes.php?action=edit+23037
http://master.php.net/manage/user-notes.php?action=delete+23037
http://master.php.net/manage/user-notes.php?action=reject+23037