I l @ ve RuBoard |
When you find it necessary to round numbers in your application, you'll be happy to know you don't have to do it manually; ColdFusion provides the round function to standardize numbers to the closest integer (whole number). When might you need to do this? Suppose your company has decided to change all their prices to whole-dollar amounts, so instead of $14.95 the price needs to be $15.00. With the database you have (or pretty much any other one, for that matter), it would be easy to go in and change the individual prices, but if you had thousands of items you might quickly come to think it wasn't so easy after all. By using Round you can implement a quick, short- term fix while the database is being updated. TIP Unfortunately, ColdFusion only rounds to whole numbers. So, if you had a number like 14.2354 and you wanted to round to two decimal places, you would first need to multiply by 100, round, and then divide the number by 100, thus yielding 14.24. You could also use the numberformat () function to round to a decimal place.
|
I l @ ve RuBoard |