User Guide

Table Of Contents
Strings 47
Integers
ColdFusion supports integers between -2,147,483,648 and 2,147,483,647 (32-bit signed
integers). You can assign a value outside this range to a variable, but ColdFusion initially stores
the number as a string. If you use it in an arithmetic expression, ColdFusion converts it into a
floating point value, preserving its value, but losing precision as the following example shows:
<cfset mybignum=12345678901234567890>
<cfset mybignumtimes10=(mybignum * 10)>
<cfoutput>mybignum is: #mybignum#</cfoutput><br>
<cfoutput>mybignumtimes10 is: #mybignumtimes10# </cfoutput><br>
This example generates the following output:
mybignum is: 12345678901234567890
mybignumtimes10 is: 1.23456789012E+020
Real numbers
Real numbers, numbers with a decimal part, are also known as floating point numbers.
ColdFusion real numbers can range from approximately -10
300
to approximately 10
300
. A real
number can have up to 12 significant digits. As with integers, you can assign a variable a value
with more digits, but the data is stored as a string. The string is converted to a real number, and
can lose precision, when you use it in an arithmetic expression.
You can represent real numbers in scientific notation. This format is xEy, where x is a positive or
negative real number in the range 1.0 (inclusive) to 10 (exclusive), and y is an integer. The value
of a number in scientific notation is x times 10
y
. For example, 4.0E2 is 4.0 times 10
2,
which
equals 400. Similarly, 2.5E-2 is 2.5 times 10
-2
, which equals 0.025. Scientific notation is useful
for writing very large and very small numbers.
Strings
In ColdFusion, text values are stored in strings. You specify strings by enclosing them in either
single- or double-quotation marks. For example, the following two strings are equivalent:
"This is a string"
'This is a string'
You can write an empty string in the following ways:
"" (a pair of double-quotation marks with nothing in between)
'' (a pair of single-quotation marks with nothing in between)
Strings can be any length, limited by the amount of available memory on the ColdFusion server.
However, the default size limit for long text retrieval (CLOB) is 64K. The ColdFusion MX
Administrator lets you increase the limit for database string transfers, but doing so can reduce
server performance. To change the limit, select the Enable retrieval of long text option on the
Advanced Settings page for the data source.