Hi Andrew,
Did you get an answer to your problem? I can't believe that no one out
there has an answer! Recently we had a similar problem with JRun using
up more and more memory until it would crashed. We played around with
all sorts of things to try to get it fixed. In the end we think it was
as
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?
I would have thought from a decimal though. Looks like it is VERY literal
_
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of grant
Sent: Monday, 13 August 2007 11:38 AM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Strange FIX() behaviour
it seems that
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. ?
not sure how to prove this theory tho...
Steve Onnis wrote:
Has anyone
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
Steve use Ceiling(number) instead, much better than Fix()
Andrew Scott
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613 8676 4223
Mobile: 0404 998 273
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Steve Onnis
Sent: Monday, 13 August
Its from a shopping cart form
Basically what I wanted to do was stop people sending decimal values more
than 2 points. The examples of the implementation I was sent from the
provider showed that they were just removing the decimal point from the
number value and sending that as the cents value.
If you do a NumberFormat of cents you get 994.9
#NumberFormat(cents), '999.999')#
On 8/13/07, Steve Onnis [EMAIL PROTECTED] wrote:
Its from a shopping cart form
Basically what I wanted to do was stop people sending decimal values more
than 2 points. The examples of the
I think its more a problem with your code - what kind of request
creates 10,000 cfc instances ?
if you see that kind of performance issue in proudction you would have
2 options.
1. refactor the code
2. get better hardware
in this instance (way too many instances junking up memory) id go for
the
This works in terms of what you are trying to achieve Steve...
cfset cents = (dollar * 1000)/10 /
Floating point maths in scripted languages has always been a pain...
Brett
B)
AJ Mercer wrote:
If you do a NumberFormat of cents you get 994.9
#NumberFormat(cents),
10 matches
Mail list logo