Yeah, dunno what I was thinking there.
Not sure if I actually woke up this morning; I've been doing similar things
through-out today. :(
>That will truncate, leaving you with zero decimal places, not two.
>This expression:
>
> #((num * 100) \ 1) / 100#
>
>will do as you want, but it has the eff
You could do numberFormat(varName, "0.00") also
Chris
-Original Message-
From: Chris Ditty [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 03, 2007 11:53 AM
To: CF-Talk
Subject: Re: Rounding to 2 decimal places.
Thanks. That fixed it. I was looking under math functions
Wait - ignore me, I'm going crazy. That doesn't work. :$
>You can avoid the round function by doing integer division:
>
>#num*100\100#
~|
Create Web Applications With ColdFusion MX7 & Flex 2.
Build powerful, scalable RIAs. Free
That will truncate, leaving you with zero decimal places, not two.
This expression:
#((num * 100) \ 1) / 100#
will do as you want, but it has the effect of truncating at two
decimal places, rather than rouding to two decimal places. E.g.,
123.4567 will become 123.45, rather than the desired 12
You can avoid the round function by doing integer division:
#num*100\100#
>#round(num * 100) / 100# will do just the math part. I.e. it won't
>add commas for thousand separators or an extra trailing zero. If you
>need to round the number and get a number (rather than a display
>string), this me
#round(num * 100) / 100# will do just the math part. I.e. it won't
add commas for thousand separators or an extra trailing zero. If you
need to round the number and get a number (rather than a display
string), this method is preferable. That code is obviously suitable
for any number of decimal p
Thanks. That fixed it. I was looking under math functions and didn't
think about looking under format. DUH. :)
thanks again
On 4/3/07, Charlie Griefer <[EMAIL PROTECTED]> wrote:
> decimalFormat()
>
> http://livedocs.adobe.com/coldfusion/7/htmldocs/0450.htm
>
> On 4/3/07, Chris Ditty <[EMAI
decimalFormat()
http://livedocs.adobe.com/coldfusion/7/htmldocs/0450.htm
On 4/3/07, Chris Ditty <[EMAIL PROTECTED]> wrote:
> Someone please tell me that this is so simple that I am just missing
> it. I am trying to round this number - 207.44047619 to 207.44.
>
> The only way that I can think
Check cflib.org, I seem to remember there being something on that for this
problem.
Adrian
-Original Message-
From: Chris Ditty [mailto:[EMAIL PROTECTED]
Sent: 03 April 2007 16:38
To: CF-Talk
Subject: Rounding to 2 decimal places.
Someone please tell me that this is so simple that
Someone please tell me that this is so simple that I am just missing
it. I am trying to round this number - 207.44047619 to 207.44.
The only way that I can think to do this would be to roll a custom
function. Is there not a 1-2 liner method to do this that I am simply
overlooking?
~
10 matches
Mail list logo