Index()

<< Click to Display Table of Contents >>

Navigation:  Explain™ Control Language  > Library Routines > Mathematical functions >

Index()

Description

Produce an INDEX from some other data type.

 

If the quantity converted is a REAL, the number is truncated at the decimal point and converted to an INDEX (signed 32-bit integer). REAL values greater than (231 – 1, approximately 2.15 × 109) are converted to 231 – 1. Correspondingly, REAL values more negative than –231 – 1 are converted to –231 – 1.

 

Some other data types can be converted as well. BITS are converted using 2's-complement arithmetic. If the most significant bit of a BITS quantity is a 1, the resulting INDEX is negative. BOOL quantities convert as a 1 for TRUE and a 0 for FALSE. A NIL converts to a zero.

 

The INDEX() function acting on a STRING is bounded, similarly to REALs. If the string does not contain a number, the return value is indeterminate.

 

The INDEX() function applied to a complex data type such as an object returns a meaningless number.

 

Type

REGULAR FUNCTION

 

Usage

Converted = Index(Item)

 

Item

REAL, BITS, BOOL, NIL, STRING

The variable to be converted.

Converted

INDEX

The result of the conversion.