ShaneEP
(MM club member)
2014-08-16 04:28 PM
FormatNumber() fails to trim decimal places on very small numbers

I do a lot of scripting that involves currency calculations. So this one caught me by surprise.

 Code:
$num = 1.4210854715202E-014
? FormatNumber($num, 2)
get $


Results in 0.0000000000000

And the reason I have to try to format such a small number is because that is what results from this sample calculation.

 Code:
$num = 729.95-629.96-99.99
? $num
? FormatNumber($num, 2)
get $


Is this expected behavior, or a bug? I would at least expect FormatNumber() to format the number properly.


Ruud van Velsen
(Hey THIS is FUN)
2015-07-22 12:04 PM
Re: FormatNumber() fails to trim decimal places on very small numbers

This is a genuine bug in KiX :-)

Excellent catch!

Fixed in the upcoming build.

Ruud


ShaneEP
(MM club member)
2015-07-31 04:22 PM
Re: FormatNumber() fails to trim decimal places on very small numbers

Thanks for the continued support and development Ruud!