Round to the nearest .5 value

2009-11-25 Thread Che Vilnonis
I'm trying to create a ratings system that shows 1/2 values. Quick question, what would be the easiest way to round a value to the nearest .5 of a number? I'm trying to avoid multiple if/elses. i.e. 3.21 would round to 3 i.e. 3.31 would round to 3.5 i.e. 3.61 would round to 3.5 i.e. 3.91 would

Re: Round to the nearest .5 value

2009-11-25 Thread Barney Boisvert
that shows 1/2 values. Quick question, what would be the easiest way to round a value to the nearest .5 of a number? I'm trying to avoid multiple if/elses. i.e. 3.21 would round to 3 i.e. 3.31 would round to 3.5 i.e. 3.61 would round to 3.5 i.e. 3.91 would round to 4 Thanks, Che

Re: Round to the nearest .5 value

2009-11-25 Thread Ian Skinner
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:

Re: Round to the nearest .5 value

2009-11-25 Thread Ian Skinner
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

RE: Round to the nearest .5 value

2009-11-25 Thread Che Vilnonis
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

Re: Round to the nearest .5 value

2009-11-25 Thread Allen Souliere
that shows 1/2 values. Quick question, what would be the easiest way to round a value to the nearest .5 of a number? I'm trying to avoid multiple if/elses. i.e. 3.21 would round to 3 i.e. 3.31 would round to 3.5 i.e. 3.61 would round to 3.5 i.e. 3.91 would round to 4 Thanks, Che

Re: Round to the nearest .5 value

2009-11-25 Thread Barney Boisvert
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

Re: Round to the nearest .5 value

2009-11-25 Thread Phillip Vector
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