Numbers

This category is everything number related.

Problems

How do I determine if a number is even or odd?
An even number is any number that can be divided by 2 with no remainder. ColdFusion provides a funct...

How do I perform trigonometric calculations?
ColdFusion provides functions for all of the common trigonometric calculations. The pi() function...

How do I work with logarithms?
The log() function returns the natural logarithm of its single numeric parameter: The exp() f...

You need to determine whether a number is positive or negative, or you need to find the absolute value of a number.
The sgn() function takes a number as its single parameter. The sgn() function will return 1 if the...

You need to format a non-currency number for output.
The decimalFormat() function is similar to the dollarFormat() function. You pass in a number, and i...

You need to format a number as a US currency for output.
The dollarFormat() function takes a number as its single parameter, and returns a formatted String. ...

You need to generate a unique identification value to track a user.
A very common task that deals with number generation is creating an UUID. UUID stands for Universal...

You need to round a number to an integer value.
ColdFusion comes with a number of built in functions to work with rounding whole numbers (integers):...

You need to test a string to see if it is a valid numeric value.
The isNumeric() function is used to directly test a variable to see if it is numeric. A Bool...

You need to work with non-US formatted numbers and currencies.
LS functions are locale specific. You can use the setLocale() function to change the current locale...