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 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 > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328687 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4