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. See Data Type and Structure of Expressions
Note
See Returning Type and Size Information (Using IDL) for information on how to determine the data type of an array.
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 Defining and Using Constants
Table 13-1 lists IDL's basic data types, provides examples of how to explicitly create a variable of each type, and list the routines used to create variables and arrays of each type. Type codes shown in the Description column correspond to the type code returned by the SIZE function for that data type.
Note
In 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.
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.
For more information on floating-point mathematics, see Mathematics (Using IDL). For information on your machine's precision, see "MACHAR" (IDL Reference Guide).
Complex Data Types
- Structures: Aggregations of data of various types. Structures are discussed in Structures.
- Pointers: A reference to a dynamically-allocated heap variable. Pointers are discussed in Pointers.
- Object References: A reference to a special heap variable that contains an IDL object structure. Object references are discussed in Creating Custom Objects in IDL (Object Programming).