Investment Studio > Expressions > Data types

Expressions describe operations on values, which may be broadly classified as either integers, floats (real numbers) or strings (text):

An integer is a whole number ranging from -2147483648 (-2^31) to 2147483647 (2^31 - 1).
A float is a real number with 15–16 significant digits, ranging from 5.0 x 10^–324 to 1.7 x 10^308 (positive or negative).
A string contains plain text, i.e. a sequence of characters subject to no other length limitation than available memory.

Values of all three types may be organized (and mixed) in arrays.

Operators and functions may interpret values according to their own special rules. Some intepretations are sufficiently common to warrant the introduction of special "data types" derived from one of those listed above:

A boolean is an integer interpreted as a logical value.

0 means FALSE, anything else means TRUE.

A date is a float interpreted as a calendar date.

The integral part is the number of whole days that have passed since December 30, 1899. The fractional part (often ignored) is the fraction of a day that has elapsed since midnight.

A time is a float interpreted as a time of day.

The integral part (often ignored) is the number of whole days that have passed since December 30, 1899. The fractional part is the fraction of a day that has elapsed since midnight.

When writing expressions, you will often find yourself feeding a value of one type to a function which expects an argument of another type. Unless the function's definition explicitly prohibits it, the argument will be automatically converted to the required data type.

Converting between integer and float types is straightforward (integers are promoted to floats with zero fractional part; floats are truncated to integers - but note that this will result in an error if the float value exceeds the integer range).

Converting between strings and numbers (integers or floats) is more problematic, since the string representations of integers, floats, dates and times depend on the computer's regional settings. See the remarks about functions value, datevalue and timevalue.

It is therefore not advisable to code numeric values as strings in your expressions. Numeric constants should always be entered as numbers.

When expressions are saved to disk, a portable format is used for all numeric constants. This guarantees that numbers (as opposed to strings representing numbers) will be unaffected even if the computer's regional settings are changed, or if files containing expressions are moved to a computer with different settings.

When working with Grids, Charts and Graphs, keep in mind that in expressions, all lookup cells only return integers. To get the referenced value of a lookup cell, use the appropriate lookup function.