I need to format some numbers without rounding them and also add two 0s if they are integers as follows.
given : 10.20 , result : 10.20 given : 10.56556, result : 10.56 given : 65000 , result : 65000.00
This is what I have so far:
<cfscript>
vars = {};
vars.rate = 10.20; // should yield to : 10.20
//vars.base_salary = 10.56556; // should yield to : 10.56
//vars.base_salary = 65000; // should yield to : 65000.00
vars.formatted1 = trim(numberFormat((vars.rate * 100) / 100, "__________.__"));
vars.formatted2 = trim(numberFormat(int(vars.rate * 100) / 100, "__________.__"));
vars.formatted3 = NumberFormat((ceiling(vars.rate*100)/100), '9.99');
writeDump(vars);
</cfscript>
Notice, formatted2 for 10.20 yields to 10.19, which is not correct. any help?