Well naturally a soon as I wrote this I answered my own question, at least
for this particular instance.  I was scaling the numbers, adding them up and
scaling them again.  I believe that would screw up.  Dropped the second
scaling and the problem is gone.

Shawn


-----Original Message-----
From: Shawn McKee [mailto:[EMAIL PROTECTED]
Sent: Monday, December 12, 2005 4:25 PM
To: CF-Talk
Subject: Re: Is this a bug in CFMX?


So if I need to accurately convert a floating point number with X digits in
the decimal portion to one with Y (Y < X) digits what do I do?  For instance
10.3456 to 10.34.

I have to do currency conversion prior to hitting a credit card.  The credit
card is limited to two decimal points but the conversion can end up with
many more.  I wrote this:

numOut = (int(numIn * 100))/100

and thought all would be well. However it is regularly off by .01 which is
obviously a problem when dealing with money.

Shawn McKee



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226884
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to