Page 1 of 1 1
Topic Options
#209428 - 2014-08-16 04:28 PM FormatNumber() fails to trim decimal places on very small numbers
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
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.

Top
#210406 - 2015-07-22 12:04 PM Re: FormatNumber() fails to trim decimal places on very small numbers [Re: ShaneEP]
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
This is a genuine bug in KiX :-)

Excellent catch!

Fixed in the upcoming build.

Ruud

Top
#210452 - 2015-07-31 04:22 PM Re: FormatNumber() fails to trim decimal places on very small numbers [Re: Ruud van Velsen]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
Thanks for the continued support and development Ruud!
Top
Page 1 of 1 1


Moderator:  ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.028 seconds in which 0.011 seconds were spent on a total of 13 queries. Zlib compression enabled.