|
|||||
|
|||||
Prerequisite Concepts | |||||
Data types |
OmniMark offers six basic data types:
You can define complex data types using records.
In addition to these basic data types, you may declare a variable of the type of any OMX component.
Integer, int32, BCD, and float are all numeric data types. How do you choose the appropriate numeric type for the data you are dealing with?
Are you creating a bit field, that is, a value that represents the on/off state of a set of bits, rather than a numerical quantity? If so, choose int32.
Are you dealing with whole number quantities with no fractional parts? If so, choose integer or BCD. Integer has marginally simpler syntax, but a limited size. Use BCD if numbers could get bigger than an integer can handle. It is also slightly easier to do arithmetic and comparisons between numbers of the same data type, so choose BCD for integer values that will be involved in calculations with other BCD values.
Are you dealing with numerical quantities with fractional parts? If so, choose BCD unless one of the following conditions applies:
In any of the above cases, use float.
When in doubt, use BCD.
There is no appreciable performance advantage in choosing float over BCD.
Note that you should base your choice of numerical types on the set of interacting values rather than on each value individually. Choosing numbers of the same type for all interacting numbers (unless obviously inappropriate) will simplify your code and save on data conversions. Never mix float and BCD numbers in the same calculation; doing so always involves a loss of precision.
Prerequisite Concepts Input functions and the markup parser |