Side note...the formatting for my email program went all weird. The numbers
I'm getting as error are as follows:
4.6E-009 * 10^6
1.7E-006
^ indicates that the next number is an exponent... The real error does not
show the ^ sign.
----- Original Message -----
From: "Stephen" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Wednesday, December 11, 2002 7:11 PM
Subject: [PHP] Move Decimal Point...Again
: Ok, nevermind about that. I fixed it finally. However, I am having trouble
: with the negative exponents. I want to find the scientific notation of
: 0.0046 which should be 4.6 * 10 to the negative 3rd. However, what I get
in
: return is this:
:
: 4.6E-009 * 106
:
: How could I fix this problem? I'm also having it for getting the standard
: form of 1.7 * 10 to the negative 6th. I get this: 1.7E-006
:
: Here's my code for finding the scientific notation:
:
: $num = $_POST['num'];
: $pos[0] = strpos($num, "1");
: $pos[1] = strpos($num, "2");
: $pos[2] = strpos($num, "3");
: $pos[3] = strpos($num, "4");
: $pos[4] = strpos($num, "5");
: $pos[5] = strpos($num, "6");
: $pos[6] = strpos($num, "7");
: $pos[7] = strpos($num, "8");
: $pos[8] = strpos($num, "9");
: array_multisort($pos, SORT_DESC);
: $exp = 0;
: $position = $pos[0] + 1;
: do {
: $num /= 10;
: $exp++;
: } while($exp < $position);
: $output = $num . " * 10<sup>".$exp."</sup>";
: echo $output;
:
: Here's the code for finding the standard form:
:
: $num = $_POST['num'];
: $exp = $_POST['power'];
: $output = $num * pow(10, $exp);
:
: Please help me! I'm lost!!
:
:
:
: --
: PHP General Mailing List (http://www.php.net/)
: To unsubscribe, visit: http://www.php.net/unsub.php
:
:
:
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php