There is a gotcha in the ColdFusion round() function that you may not have seen. According to the ColdFusion docs, a value ending in .5 will always be rounded up to the nearest integer. However, ColdFusion has two ways of casting real numbers into underlying Java datatypes - double and float. It appears that when numbers are cast as double, they may not round up. Take a look at this sample code someone I know was having a problem with:
<cfscript>
AmounttoTax = 30;
CATaxExt = AmounttoTax * 0.0725;
CATax = Round(CATaxExt * 100) / 100;
</cfscript>
<cfoutput>#CATax#<br></cfoutput>
According to the CF documentation, this code should yield a value of 2.18, because the original value of 217.5 (2.175 * 100) should be rounded up to 218. Instead, it rounds down to 217, and the resulting value is 2.17.
Let's try changing the underlying datatype:
<cfscript>
AmounttoTax = 30;
CATaxExt = AmounttoTax * 0.0725;
CATax = Round(javacast("float",CATaxExt * 100)) / 100;
</cfscript>
<cfoutput>#CATax#<br></cfoutput>
This code yields the expected value of 2.18.
Just to be sure, let's cast the value explicitly into a double:
<cfscript>
AmounttoTax = 30;
CATaxExt = AmounttoTax * 0.0725;
CATax = Round(javacast("double",CATaxExt * 100)) / 100;
</cfscript>
<cfoutput>#CATax#<br></cfoutput>
Once again, we end up with a value of 2.17 instead of 2.18, leading (in the case of this code example) to a tax calculation that is one penny short of the correct withholding amount for the transaction. One penny may not be a lot in isolation, but over a large volume of transactions it may acculumulate into a non-trivial amount.