scientific notation to decimal
| From: | Dean Hall | Date: | Thu, 12 Oct 2000 14:49:23 +0000 |
| Subject: | scientific notation to decimal | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-19814@lists.php.net to get a copy of this message | ||
I posted this before, but no one seemed to wish to answer. So I'll enunciate
my problem a bit better.
I'm adding to integers, like so:
function getSum() {
...
return $s1 + $s2;
}
Then somewhere I do this:
$sum = getSum();
$sum is a valid 'double' value, but it's in scientific notation, like this:
"9.7136607599772E+16". I'm using this number as an integer to delete
conditionally in my database, and I need to get it out of scientific
notation into decimal notation, like this: "971366075997720". I know a
'long' can store this on my machine, but PHP doesn't seem to differentiate
between 'int's and 'long's. When I try to convert it to an 'int', I
get a
negative number.
Does anyone have any idea how I can get this out of scientific notation into
decimal? I'd like to shy away from bcmath if I can, but if I have to, I can
just recompile PHP with bcmath and try it that way. Any ideas?
Dean.