Assuming 'n' is your number, use #round(n * 2) / 2#
For example:
3.21 * 2 == 6.42
round(6.42) == 6
6 / 2 == 3
3.31 * 2 = 6.62
round(6.62) == 7
7 / 2 == 3.35
cheers,
barneyb
On Wed, Nov 25, 2009 at 11:13 AM, Che Vilnonis ch...@asitv.com wrote:
I'm trying to create a ratings system that
Che Vilnonis wrote:
Multiply number by 2, round it, divide it by 2.
~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
Barney Boisvert wrote:
7 / 2 == 3.35
No it doesn't! I suspect your typing thumbs, or is it your ring finger,
is making you look like a bad mathematician! ;-)
~|
Want to reach the ColdFusion community with something they
Sweet! Many years ago, in high school Algebra class, I would have been able
to figure that out. It's amazing what we forget.
-Original Message-
From: Barney Boisvert [mailto:bboisv...@gmail.com]
Sent: Wednesday, November 25, 2009 2:23 PM
To: cf-talk
Subject: Re: Round to the nearest .5
cfoutput
#Round(3.21/0.5) *0.5#
#Round(3.31/0.5) *0.5#
#Round(3.61/0.5) *0.5#
#Round(3.91/0.5) *0.5#
#Round(4.24/0.5) *0.5#
#Round(4.49/0.5) *0.5#
#Round(4.50/0.5) *0.5#
/cfoutput
produces:
3
3.5
3.5
4
4
4.5
4.5
Cheers,
Allen
Che Vilnonis wrote:
I'm trying to create a ratings system that
Oops, you're right, Ian. That should be 7 / 2 == 3.5 (remove the
second three), of course. I wonder who had coffee this morning and
therefore can't control his fine motor skills. At least with a
computer your assertions are actually checked, so typos get caught.
:)
cheers,
barneyb
On
That is beautiful in form and simplicity. Bravo.
On Wed, Nov 25, 2009 at 11:27 AM, Ian Skinner h...@ilsweb.com wrote:
Multiply number by 2, round it, divide it by 2.
~|
Want to reach the ColdFusion community with something
7 matches
Mail list logo