That works. Thanks everyone who responded! I also found that numberformat
with a mask of 999999.9 rounds it correctly also. Don't really know why
though.
Rick
-----Original Message-----
From: Bud [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 16, 2000 3:06 PM
To: CF-Talk
Subject: Re: rounding to first decimal
On 11/16/00, Rick Lamb penned:
>I thought this would be simple. How can round a long integer eg: 2.146752
to
>the first decimal point?
That's not an integer. LOL
This is the way I do it:
<cfset number = "2.146752">
<cfset number = round(2.146752 * 10) / 10>
= 2.1
Add another 0 for each decimal you want to round to:
<cfset number = round(2.146752 * 100) / 100>
= 2.15
<cfset number = round(2.146752 * 1000) / 1000>
= 2.147
--
Bud Schneehagen - Tropical Web Creations
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
Structure your ColdFusion code with Fusebox. Get the official book at
https://secure.houseoffusion.com
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
https://secure.houseoffusion.com
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists