How to Convert Percentages to Decimals in Cold Fusion
Use the division operator to convert a percentage number to a decimal. For instance, ".50" represents 50 percent as a decimal number. Divide the percentage number in Cold Fusion and use the Cold Fusion output tags to display the decimal result.
Instructions
-
-
1
Right-click the Cold Fusion file you want to use to display the decimal results. Click "Open With," then select the Cold Fusion editor.
-
2
Create a variable to hold the converted value. This code creates a variable:
<cfset decNum = 0.00>
-
-
3
Include a percentage variable, if you do not already have a variable defined. The following code creates a percentage variable:
<cfset percNum = 50>
-
4
Convert the percentage number to a decimal. The following code returns ".50" to represent 50 percent in the "percNum" variable:
decNum = percNum/100
-
5
Display the result on the Cold Fusion page with this calculation result code:
<cfoutput>#decNum#</cfoutput>
-
1