SO_Tadamichi
SO_Tadamichi

Reputation: 9

ColdFusion round decimal value

<cfif (NOT IsNull(nt)) and (NOT IsNull(kt)) >
    <cfset ct= (nt * kt) / 100>
<cfelse>
    <cfset ct= 00.00 >
</cfif>

let nt = 77 and kt = 13. ct will be 10.01.

I want to round the result to be 10.00.

I tried using round(ct), floor(ct).

`floor(62.72)` 
`floor(62.72)` 
`value="#Numberformat(ct,',9.99')#"`

Other scenario : if ct = 12.31, result should be 12.30, if ct = 22.48, result should be 22.48 (Not changed)

Upvotes: 1

Views: 97

Answers (1)

Underscore
Underscore

Reputation: 21

You want the Fix function

Fix(10.01) will result in 10

Upvotes: 2

Related Questions