First, multiply the decimal number by the number of decimal places you want
to preserve (10 for 1, 100 for 2, etc.).  Add 0.5 to the resulting number
and cast it to an Integer.  Then divide by the resulting number by the
number mutiplied by at first.

Code Sample:

<cfset Places = 100>

<cfset tempNumber = Decimal * Places>
<cfset tempNumber = Int(tempNumber + 0.5)>

<cfset DecimalNumber = tempNumber / Places>

I didn't test this, so use at your own peril :)

Russel

============================================================
  Russel Madere, Jr.         Senior Web Developer
  ICQ: 5446158               http://www.TurboSquid.com

Some days you eat the bear; some days the bear eats you.
============================================================


-----Original Message-----
From: Robert Everland [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 11, 2000 11:22
To: CF-Talk
Subject: Round Decimals


        Ok I know of ceiling and round but how do I round decimals. Say I
have 4.59 how do I get it to say 4.6 or if I have 4.585 to be 4.59

Robert Everland III
Web Developer
Dixon Ticonderoga
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to