Datatype functions

Revision as of 01:14, 1 June 2016 by Bbecane (talk | contribs)


A value can be a number, text, Null, or a reference. Integers, reals, Boolean, and date values, are all represented as numbers. You can use these functions from the Special library of Definition menu to determine the type.

IsNumber(x): Returns True if «x» is a number, including a boolean, date, INF, NaN, or complex. See also IsNumber().

IsNumber(0) → True
IsNumber(False) → True
IsNumber(INF) → True
IsNumber('hi') → False
IsNumber(5) → True
IsNumber('5') → False
IsNumber(NAN) → True

IsText(x): Returns True if «x» is a text value. See also IsText().

IsText('hello') → True
IsText(7) → False
IsText('7') → True

IsNaN(x): Returns True if «x» is “not a number,” i.e., NaN. INF or regular numbers do not qualify, nor does a text or Null. See also IsNaN().

0/0 → NAN
IsNaN(0/0) → True
IsNaN(5) → False
IsNaN(INF) → False
IsNaN('Hello') → False

IsNull(x): To test if «x» is exactly Null. Returns false if «x» is an array. See also IsNull().

x = NULL: To test if an atomic «x» is Null. When «x» is an array, returns True or False for each element of the array.

IsUndef(x): Returns True if atomic «x» is Null or the internal value Undefined (usually indicating uncomputed). When «x» is an array, returns True or False for each element of the array. See also IsUndef().

IsRealNumber(x): Returns True when «x» is a real number, including a boolean, date or INF. Returns False when «x» is a complex number or NaN. See also IsRealNumber().

IsReference(x): Returns True if «x» is a reference to a value. See also IsReference().

IsHandle(x): Returns True if «x» is a handle to an Analytica object. See also IsHandle(x).

TypeOf(x): Returns the type of expression «x» as a text value, usually one of Number, Text, Reference, or Null. INF and NaN are both of type "Number". See also TypeOf().

TypeOf(2008) → "Number"
TypeOf('2008') → "Text"
TypeOf(INF) → "Number"
TypeOf(0/0) → "Number"

See Also


Comments


You are not allowed to post comments.