Skip to main content

New round() Precision In Adobe ColdFusion 2025 Update 8

By Web Design2 min read

This is a super minor improvement in the recent releases of Adobe ColdFusion 2025, but the need has come up in my code enough to merit a quick mention. The round() function now accepts a number of decimal places for rounding precision. Historically, the round() function has only rounded to the nearest integer. Which meant that if you wanted to round to, for example, 2 decimal places, you had to jump through some hoops to get there. But now, you can just pass a second argument with the number of decimals places desired.

Here’s a quick demo:



	value = 123.45678;

	writeDump([
		"Original Value": value,

		// OLD: Using number format.
		"Number Format": numberFormat( value, ",0.000" ),

		// OLD: Using decimal shifting.
		"Decimal Shifting": ( round( value * 1000 ) / 1000 ),

		// NEW: Using new round precision.
		"Round Precision": round( value, 3 ),
	]);


In the call to round(), I’m passing in 3, which will round the decimal value to the 3rd decimal point:

Screenshot of CFDump showing rounding result using various methods - all outcomes are the same (visually).

One thing to note is that only the numberFormat() approach will include the commas if the integer portion is larger than 1,000. The round() approach simply truncates the decimal portion to the given number of decimal places; but it doesn’t apply any other formatting.

Check out the license.


https://bennadel.com/4905


Source link