|
 |
"Kenneth" <kdw### [at] gmail com> wrote:
> Forget my clumsy string-code
> version; this one is certainly more compact and easy to grasp. It works with all
> float values, as far as I know from many tests. I have included the code itself
> and as a macro. The output is again as a #debug message.
Forget my crummy early-morning loop suggestion. Just use int(log(abs(num)))
No idea what you're doing in your code,
but 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
- BW
Post a reply to this message
|
 |