note 110658 added to function.bcmul
| From: | gar37bic at gmail dot com | Date: | Mon, 19 Nov 2012 17:06:28 +0000 |
| Subject: | note 110658 added to function.bcmul | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-192037@lists.php.net to get a copy of this message | ||
When using printf to print the results of bcmath operations, use string format, i.e. '%s',
not numeric formats such as '%d' or '%f'. For example, the output of factorial
(23) will be incorrect if using %d or %f:
Result using %f:
factorial (22) = 1124000727777607680000 (correct)
factorial (23) = 25852016738884978212864 (incorrect)
Result using %s:
factorial (22) = 1124000727777607680000
factorial (23) = 25852016738884976640000
Using echo, this is not a problem - PHP will output the bcmath string type correctly.
----
Server IP: 192.41.42.26
Probable Submitter: 216.129.152.115
----
Manual Page -- http://www.php.net/manual/en/function.bcmul.php
Edit -- https://master.php.net/note/edit/110658
Del: integrated -- https://master.php.net/note/delete/110658/integrated
Del: useless -- https://master.php.net/note/delete/110658/useless
Del: bad code -- https://master.php.net/note/delete/110658/bad+code
Del: spam -- https://master.php.net/note/delete/110658/spam
Del: non-english -- https://master.php.net/note/delete/110658/non-english
Del: in docs -- https://master.php.net/note/delete/110658/in+docs
Del: other reasons-- https://master.php.net/note/delete/110658
Reject -- https://master.php.net/note/reject/110658
Search -- https://master.php.net/manage/user-notes.php