Skip to content

Instantly share code, notes, and snippets.

@adamcameron
Created December 28, 2023 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamcameron/0bac4889614c7fbad1177f0b88f68861 to your computer and use it in GitHub Desktop.
Save adamcameron/0bac4889614c7fbad1177f0b88f68861 to your computer and use it in GitHub Desktop.
Shows how various functions round in CFML. For comparing CF to Lucee
<cfscript>
numbers = [511.925,512.925,654.925,655.925]
functions = [
"decimalFormat(##x##)",
"right(dollarFormat(##x##), -1)",
'numberFormat(##x##, "9.00")'
]
</cfscript>
<cfoutput>
<table border="1">
<tr>
<th>f\x</th>
<cfloop index="x" array="#numbers#"><th>#x#</th></cfloop>
</tr>
<cfloop index="f" array="#functions#">
<tr>
<td>#f#</td>
<cfloop index="x" array="#numbers#">
<td>#evaluate(f)#</td>
</cfloop>
</tr>
</cfloop>
</table>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment