note 65701 added to function.bcdiv
| From: | RobertLozyniak at osu1 dot php dot net | Date: | Fri, 05 May 2006 23:05:07 +0000 |
| Subject: | note 65701 added to function.bcdiv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-110670@lists.php.net to get a copy of this message | ||
Let me see if I can clarify:
If you pass a _string_ such as "1E2" to a BC math function, it will stop reading as soon
as it sees the "E". (The BC math functions do not know scientific notation.)
If you set the variable $foo equal to the _numeric_ 1E2, the variable $foo will then contain the
mathematical number known as "one hundred".
If you then pass $foo to a BC math function, PHP will convert the contents of $foo (the mathematical
number one hundred) into the string "100". This is the same exact behaviour you would get
if you tried to evaluate $foo." apples": you have something which expects a string but you
are passing it a number, so the number gets converted to a string.
However, if you try to pass a googol (or rather, the closest IEEE double-precision floating-point
number to a googol) to BC math this way, I would not expect it to work. Why? Because PHP would try
to write that googol (excuse me, approximation to a googol) in scientific notation (it would,
wouldn't it? I'm too lazy to try it), and BC math does not know scientific notation. So
there.
----
Server IP: 216.194.113.175
Probable Submitter: 172.166.169.55
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.bcdiv.php
Edit -- http://master.php.net/note/edit/65701
Del: integrated -- http://master.php.net/note/delete/65701/integrated
Del: useless -- http://master.php.net/note/delete/65701/useless
Del: bad code -- http://master.php.net/note/delete/65701/bad+code
Del: spam -- http://master.php.net/note/delete/65701/spam
Del: non-english -- http://master.php.net/note/delete/65701/non-english
Del: in docs -- http://master.php.net/note/delete/65701/in+docs
Del: other reasons-- http://master.php.net/note/delete/65701
Reject -- http://master.php.net/note/reject/65701
Search -- http://master.php.net/manage/user-notes.php