I remember a thread from here a while back discussing the various 
idiosyncrasies of floating point arithmetic, and that you should be 
really storing money in cent amounts.

I've got no first hand experience in this, but have a flip thru the 
archives.

David Harris wrote:
> Something odd is happening there
>
> If you do this:
>
> <cfset cents = 995 >
> <cfoutput>
>  #FIX(cents)#
> </cfoutput>
>
> you get the expected result. eg: 995
>
> The only thing that springs to mind is that maybe:
>
> 9.95 * 100 = 994.99999999 ?
>
> not sure how to prove this theory tho...
>
>
>
> Steve Onnis wrote:
>   
>> Has anyone come across this before?
>>
>> <cfset dollar = 9.95 />
>> <cfset cents = dollar * 100 />
>> <cfoutput>
>> #FIX(cents)#
>> </cfoutput>
>>
>> outputs 994
>>
>> I could maybe understand this is i had more decimal places but it is a plain
>> 2 point decimal value.
>>
>> Any ideas?
>>
>>
>>
>>
>> <http://www.inevative.com.au/images/email-stationary/inevativeLogo_small.jpg
>>     
>> Steve Onnis
>>
>>
>> Director / Head Developer
>>
>>
>>   <http://www.inevative.com.au/images/email-stationary/email.jpg>
>> [EMAIL PROTECTED]
>>
>>   <http://www.inevative.com.au/images/email-stationary/phone.jpg> +61 3 9001
>> 2258
>>
>>   <http://www.inevative.com.au/images/email-stationary/mobile.jpg> 0401 667
>> 996
>>
>>   <http://www.inevative.com.au/images/email-stationary/web.jpg>
>> www.inevative.com.au
>>
>>  <http://www.novahost.com.au>   <http://www.threesquares.com.au>
>> <http://www.smsonline.com.au>
>>     
>
>
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to