INDEX()

INDEX()

Type: REGULAR FUNCTION

Purpose: Produce an INDEX from some other datatype.

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.

Usage: Converted = Index(Item)

 

Converted INDEX

The result of the conversion.

 

Item REAL or The variable to be converted.

BITS

BOOL

NIL

STRING

Related Topics Link IconRelated Topics