## Data Types

The IDL language is dynamically typed. This means that an operation on a variable can change that variable's type. In general, when variables of different types are combined in an expression, the result has the data type that yields the highest precision.

For example, if an integer variable is added to a floating-point variable, the result will be a floating-point variable.

### Basic Data Types

In IDL there are twelve basic, atomic data types, each with its own form of constant. The data type assigned to a variable is determined either by the syntax used when creating the variable, or as a result of some operation that changes the type of the variable.

IDL's basic data types are discussed in more detail beginning with Constants.

• Byte: An 8-bit unsigned integer ranging in value from 0 to 255. Pixels in images are commonly represented as byte data.
• Integer: A 16-bit signed integer ranging from -32,768 to +32,767.
• Unsigned Integer: A 16-bit unsigned integer ranging from 0 to 65535.
• Long: A 32-bit signed integer ranging in value from approximately minus two billion to plus two billion.
• Unsigned Long: A 32-bit unsigned integer ranging in value from 0 to approximately four billion.
• 64-bit Long: A 64-bit signed integer ranging in value from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807.
• 64-bit Unsigned Long: A 64-bit unsigned integer ranging in value from 0 to 18,446,744,073,709,551,615.
• Floating-point: A 32-bit, single-precision, floating-point number in the range of ±1038, with approximately six or seven decimal places of significance.
• Double-precision: A 64-bit, double-precision, floating-point number in the range of ±10308 with approximately 14 decimal places of significance.
• Complex: A real-imaginary pair of single-precision, floating-point numbers. Complex numbers are useful for signal processing and frequency domain filtering.
• Double-precision complex: A real-imaginary pair of double-precision, floating-point numbers.
•  Note
In previous versions of IDL prior to version 4, the combination of a double-precision number and a complex number in an expression resulted in a single-precision complex number because those versions of IDL lacked the DCOMPLEX double-precision complex data type. Starting with IDL version 4, this combination results in a DCOMPLEX number.

• String: A sequence of characters, from 0 to 2147483647 (2.1 GB) characters in length, which is interpreted as text.

#### Precision of Floating-Point Numbers

The precision of IDL's floating-point numbers depends somewhat on the platform involved and the compiler and specific compiler switches used to compile the IDL executable. The values shown here are minimum values; in some cases, IDL may deliver slightly more precision than we have indicated. If your application uses numbers that are sensitive to floating-point truncation or round-off errors, or values that cannot be represented exactly as floating-point numbers, this is something you should consider.