Surprisingly, neither ASP nor PHP seem to have a built-in way of formatting a number in scientific notation. Today we're going to change that.
ASP
function formatScientific(someFloat)dim powerpower = (someFloat mod 10) - 1formatScientific = cStr(cDbl(someFloat) / 10^power) & "e" & cStr(power)end function
PHP
function formatScientific($someFloat){$power = ($someFloat % 10) - 1;return ($someFloat / pow(10, $power)) . "e" . $power;}

0 comments:
Post a Comment