View comments | RSS feed

Round

Description

Rounds a number to the closest integer that is larger than the input parameter.

Returns

An integer.

Category

Mathematical functions

Function syntax

Round(number)

See also

Ceiling, Fix, Int

Parameters

Parameter Description

number

Number to round

Usage

Use this function to round a number. This function rounds numbers that end with .5 up to the nearest integer. It rounds 3.5 to 4 and -3.5 to -3.

Example

<h3>Round Example</h3>
<p>This function rounds a number to the closest integer.
<ul>
   <li>Round(7.49) : <cfoutput>#Round(7.49)#</cfoutput>
   <li>Round(7.5) : <cfoutput>#Round(7.5)#</cfoutput>
   <li>Round(-10.775) : <cfoutput>#Round(-10.775)#</cfoutput>
   <li>Round(-35.5) : <cfoutput>#Round(-35.5)#</cfoutput>
   <li>Round(35.5) : <cfoutput>#Round(35.5)#</cfoutput>
   <li>Round(1.2345*100)/100 : <cfoutput>#Round(1.2345*100)/100#</cfoutput>
</ul>

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting

Version 7

Comments


webnina said on Feb 25, 2006 at 9:05 PM :
explanation of Round is confusing: Rounds a number to the closest integer that is larger than the input parameter.
Round(7.2) is 7 - does not seem to be larger than input parameter.

The statement above is only true when decimal part is equal .5 and decision has to be made which of two equally close integers we should select.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/7/htmldocs/00000619.htm