Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.
﻿

>  Docs Center  >  IDL Reference  >  Advanced Math and Stats  >  IMSL_MACHINE

IMSL_MACHINE

# IMSL_MACHINE

The IMSL_MACHINE function returns information describing the computerâs arithmetic.

The IMSL_MACHINE function returns information describing the computerâs arithmetic. This can be used to make programs machine independent. The information returned by IMSL_MACHINE is in the form of a structure. A different structure is used for each type: integer, float, and double. Depending on how IMSL_MACHINE is called, a different structure is returned.

The default action of IMSL_MACHINE is to return the structure IMACHINE which contains integer information on the computerâs arithmetic. By using either the keywords Float or Double, information about the floating- or double-precision arithmetic is returned in structures FMACHINE or DMACHINE.

The contents of the these structures are described below.

## Integer Information: IMACHINE

Assume that integers are represented in M-digit, base A form as:

where Ï is the sign and 0 â¤ xk < A for k = 0, ..., M. Then, the table below describes the tags:

Tag Definition
BITS_PER_CHAR C, bits per character
INTEGER_BASE A, the base
INTEGER_DIGITS Ms, the number of base-A digits in a short int
MAX_INTEGER â 1, the largest short int
LONG_DIGITS Ml, the number of base-A digits in a long int
MAX_LONG â 1, the largest long int

Assume that floating-point numbers are in N-digit, base B form as:

where Ï is the sign and 0 â¤ xk < B for k = 1, ..., N for and Emin â¤ E â¤ Emax. Then, the table below describes the tags:

Tag

Definition

FLOAT_BASE

B, the base

FLOAT_DIGITS

Nf, the number of base-B digits in float

FLOAT_MIN_EXP

, the smallest float exponent

FLOAT_MAX_EXP

, the largest float exponent

DOUBLE_DIGETS

Nd, the number of base-B digits in double

DOUBLE_MIN_EXP

, the largest long int

DOUBLE_MAX_EXP

, the number of base-B digits in double

## Floating- and Double-precision Information: FMACHINE and DMACHINE

Information concerning the floating- or double-precision arithmetic of the computer is contained in the structures FMACHINE and DMACHINE. These structures are returned into named variables by calling IMSL_MACHINE with the keywords Float for FMACHINE and Double for DMACHINE.

Assume that float numbers are represented in Nf- digit, base B form as:

where Ï is the sign, 0 â¤ xk < B for k = 1, 2, ..., Nf and

â¤ E â¤

Note that if we make the assignment imach = IMSL_MACHINE( ), then B = imach.FLOAT_BASE, Nf = imach.FLOAT_DIGITS,

= imach.FLOAT_MIN_EXP

and:

= imach.FLOAT_MAX_EXP

The ANSI/IEEE 754-1985 standard for binary arithmetic uses NaN (Not a Number) as the result of various otherwise illegal operations, such as computing 0/0. If the assignment amach = IMSL_MACHINE(/FLOAT) is made, then on computers that do not support NaN, a value larger than amach. MAX_POS is returned in amach.NAN. On computers that do not have a special representation for infinity, amach.POS_INF contains the same value as amach.MAX_POS.

The structure IMACHINE is defined by the table below:

Tag

Definition

MIN_POS

, the smallest positive number

MAX_POS

, the largest number

MIN_REL_SPACE

B â Nf, the smallest relative spacing

MAX_REL_SPACE

B1 â Nf, the largest relative spacing

LOG10_BASE

log10(B)

NAN

NaN

POS_INF

positive machine infinity

NEG_INF

negative machine infinity

The structure DMACHINE contains machine constants that define the computerâs double arithmetic. Note that for double, if the assignment imach = IMSL_MACHINE( ) is made, then:

B = imach.FLOAT_BASE, Nf = imach.DOUBLE_DIGITS

= imach.DOUBLE_MIN_EXP

and:

= imach.DOUBLE_MAX_EXP

Missing values in IDL Advanced Math and Stats procedures and functions are often indicated by NaN. There is no missing-value indicator for integers. Users usually have to convert from their missing value indicators to NaN.

© 2018 Harris Geospatial Solutions, Inc. |  Legal