|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
> try:
>
> #macro SciNot (Num, Precision)
> #if (Num = 0)
> #local Result = "0\n"
> #else
> #local Exponent = int(log(abs(Num)));
> #local Significand = Num/pow(10, Exponent);
> #local Result = concat (str(Significand, 0, Precision), " x 10^", str(Exponent,
> 0, 0), "\n")
> #end // end if
> #debug Result
> #end // end macro
>
(I changed your " x 10^" to "e" )
Yes, it works and is quite elegant, although it's a bit beyond my mental grasp
as to how. I haven't used logarithms since my college days, ha.
Although: For fractional values like .000794, it returns 0.794e-3. Shouldn't it
return 7.94e-4 instead?
Post a reply to this message
|
 |