note 65701 deleted from function.bcdiv by didou
| From: | didou@php.net | Date: | Sat, 27 Jan 2007 14:15:22 +0000 |
| Subject: | note 65701 deleted from function.bcdiv by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-122265@lists.php.net to get a copy of this message | ||
Note Submitter: Robert Lozyniak
----
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.