Difference between revisions of "Datatype functions"

(IsNotSpecified)
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:Analytica User Guide]]
 
[[Category:Analytica User Guide]]
<breadcrumbs>Analytica User Guide > Using Expressions > {{PAGENAME}}</breadcrumbs>
+
[[Category: Data Type Functions]]
 +
<breadcrumbs>Analytica User Guide > Expressions > {{PAGENAME}}</breadcrumbs>
  
  
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.
+
A value can be a number, text, [[Null]], a [[handle]] or a [[reference]]. Integers, reals, Boolean, and date values, are all represented as numbers. You can use these functions from the [[Special_Functions_library|Special]] library of [[Definition menu]] to determine the type.
  
'''IsNumber(x)''': Returns <code>True</code> if «x» is a number, including a boolean, date, <code>INF</code>, <code>NAN</code>, or complex. See also [[IsNumber]]().
+
'''IsNumber(x)''': Returns <code>True</code> if «x» is a number, including a boolean, date, [[INF]], [[NaN]], or complex. See also [[IsNumber]]().
 
:<code>IsNumber(0) &rarr; True </code>
 
:<code>IsNumber(0) &rarr; True </code>
 
:<code>IsNumber(False) &rarr; True </code>
 
:<code>IsNumber(False) &rarr; True </code>
Line 19: Line 20:
 
:<code>IsText('7') &rarr; True</code>
 
:<code>IsText('7') &rarr; True</code>
  
'''IsNaN(x)''': Returns <code>True</code> if «x» is “not a number,” i.e., <code>NAN</code>. <code>INF</code> or regular numbers do not qualify, nor does a text or [[Null]]. See also [[IsNaN]]().
+
'''IsNaN(x)''': Returns <code>True</code> 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]]().
 
:<code>0/0 &rarr; NAN</code>
 
:<code>0/0 &rarr; NAN</code>
 
:<code>IsNaN(0/0) &rarr; True </code>
 
:<code>IsNaN(0/0) &rarr; True </code>
Line 32: Line 33:
 
'''IsUndef(x)''': Returns <code>True</code> if atomic «x» is [[Null]] or the internal value [[Undefined]] (usually indicating uncomputed). When «x» is an array, returns <code>True</code> or <code>False</code> for each element of the array. See also [[IsUndef]]().
 
'''IsUndef(x)''': Returns <code>True</code> if atomic «x» is [[Null]] or the internal value [[Undefined]] (usually indicating uncomputed). When «x» is an array, returns <code>True</code> or <code>False</code> for each element of the array. See also [[IsUndef]]().
  
'''IsRealNumber(x)''': Returns <code>True</code> when «x» is a real number, including a boolean, date or <code>INF</code>. Returns <code>False</code> when «x» is a complex number or <code>NAN</code>. See also [[IsRealNumber]]().
+
'''IsRealNumber(x)''': Returns <code>True</code> when «x» is a real number, including a boolean, date or [[INF]]. Returns <code>False</code> when «x» is a complex number or [[NaN]]. See also [[IsRealNumber]]().
  
 
'''IsReference(x)''': Returns <code>True</code> if «x» is a reference to a value. See also [[IsReference]]().
 
'''IsReference(x)''': Returns <code>True</code> if «x» is a reference to a value. See also [[IsReference]]().
Line 38: Line 39:
 
'''IsHandle(x)''': Returns <code>True</code> if «x» is a handle to an Analytica object. See also [[IsHandle]](x).
 
'''IsHandle(x)''': Returns <code>True</code> 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 <code>Number, Text, Reference</code>, or [[Null]]. <code>INF</code> and <code>NAN</code> are both of type <code>"Number"</code>. See also [[TypeOf]]().
+
'''TypeOf(x)''': Returns the type of expression «x» as a text value. Real numbers will be <code>'Number'</code>, <code>'FixedPoint'</code>, or <code>'Integer'</code>, depending on how «x» is internally represented. Other common values are <code>'DateTime'</code>, <code>'ComplexNumber'</code>,
:<code>TypeOf(2008) &rarr; "Number" </code>
+
<code>'Text'</code>, <code>'Reference'</code>, and <code>'Null'</code>. [[INF]] and [[NaN]] are both of type <code>"Number"</code>. See also [[TypeOf]]().
 +
:<code>TypeOf([[Pi]]) &rarr; "Number"</code>
 +
:<code>TypeOf(2008) &rarr; "Integer" </code>
 
:<code>TypeOf('2008') &rarr; "Text" </code>
 
:<code>TypeOf('2008') &rarr; "Text" </code>
 
:<code>TypeOf(INF) &rarr; "Number" </code>
 
:<code>TypeOf(INF) &rarr; "Number" </code>
 
:<code>TypeOf(0/0) &rarr; "Number"</code>
 
:<code>TypeOf(0/0) &rarr; "Number"</code>
 +
:<code>TypeOf(Null) &rarr; "Null"</code>
 +
:<code>TypeOf(\2008) &rarr; "Reference"</code>
 +
 +
'''IsNotSpecified'''(x): Used in a [[User-defined function]] with an optional function parameter «x» to test whether the parameter was omitted be the caller. When omitted, «x» has the special internal value of [[Undefined]]. See also [[IsNotSpecified]].
 +
:<code>[[If]] [[IsNotSpecified]](x) [[Then]] x := a;</code>
  
 
==See Also==
 
==See Also==
 +
<div style="column-count:2;-moz-column-count:2;-webkit-column-count:2">
 
* [[Data Type Functions]]
 
* [[Data Type Functions]]
 +
* [[TypeOf]]
 +
* [[IsNumber]]
 +
* [[IsRealNumber]]
 +
* [[IsNaN]]
 +
* [[IsText]]
 +
* [[IsReference]]
 +
* [[IsHandle]]
 +
* [[IsNull]]
 +
* [[IsUndef]]
 +
* [[IsNotSpecified]]
 +
* [[Special Functions library]]
 +
* [[Function_parameter_qualifiers#Data_type_qualifiers| Data types of function parameters]]
 +
* [[Multiple formats in one table]]
 +
</div>
 +
  
<footer>Warnings / {{PAGENAME}} / Arrays and Indexes</footer>
+
<footer>Warnings / {{PAGENAME}} / Text, Date, Math, and Financial Functions</footer>

Latest revision as of 17:57, 4 August 2017


A value can be a number, text, Null, a handle 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. Real numbers will be 'Number', 'FixedPoint', or 'Integer', depending on how «x» is internally represented. Other common values are 'DateTime', 'ComplexNumber', 'Text', 'Reference', and 'Null'. INF and NaN are both of type "Number". See also TypeOf().

TypeOf(Pi) → "Number"
TypeOf(2008) → "Integer"
TypeOf('2008') → "Text"
TypeOf(INF) → "Number"
TypeOf(0/0) → "Number"
TypeOf(Null) → "Null"
TypeOf(\2008) → "Reference"

IsNotSpecified(x): Used in a User-defined function with an optional function parameter «x» to test whether the parameter was omitted be the caller. When omitted, «x» has the special internal value of Undefined. See also IsNotSpecified.

If IsNotSpecified(x) Then x := a;

See Also


Comments


You are not allowed to post comments.