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 Online   content
MM club member
*****

Registered: 2002-11-29
Posts: 2082
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 Offline
Developer
*****

Registered: 1999-05-06
Posts: 359
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 Online   content
MM club member
*****

Registered: 2002-11-29
Posts: 2082
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, Mart 
Hop to:
Shout Box

Who's Online
2 registered (b15145, mole) and 194 anonymous users online.
Newest Members
Stefan_H, khalidkhan786, BigDGeorge, jefff, QCarvalho
17672 Registered Users

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