Number Overview

Analytic supports the Number data type for representing various numeric values. The Number data type has three subtypes: Integer, Money, and Percent. The Number data type and all of its subtypes can be extended by using the addMethod and defmethod functions.

When to Use

The Number Native data type is a suitable container for numeric values. Several mathematical functions are provided by Analytic Information Server that perform several common computations.

Number Subtypes


The Integer Native Data Type are containers for whole numbers only. An Integer is a 32 bit integer value. The constant form for Integers are simple the number:

34 -34



The Money Data Type are containers for monetary values. Money is an IEEE double precision real number representing U.S. currency values. Money constants can be written as signed whole numbers or signed fractions starting with the $ symbol. Normal arithmetic can be performed on the Money Data Type.


$-4.56 $1845 $345.89 $-192745



The Percent Data Type are containers for percentage values. Percent constants can be written as signed whole numbers or signed fractions ending with the % symbol.


2% -34% .02% 1.28%


Terminating a numeric constant with the percent operator has the effect of dividing the constant by 100.

Constant Form

The Number Data and all of its subtypes have constant forms. The Number Data type can be represented by scientific notation such as:


1.2e8 -4.567e-34


or as a real number:


-345.8907 3.141592


or as a whole number:


34 -34


Native Data Type

The Number Data Type is an example of an AIS Native Data Type.

Analytic Information Server stores all of its Native Data Types in Virtual Machine Containers. All containers are stored in memory. Containers provide the basic storage mechanism for modeling data of all types. Containers provide these fundamental characteristics:

Ability to hold any type of data (including code) at any time.

Ability to know what type of data is contained.

Ability to be stored, retrieved and evaluated by the system.

Ability to handle type conversion, and memory management automatically.

Containers come in two sizes, Large and Small. Small containers are six bytes in length, and large containers are ten bytes in length. Large containers can store larger amounts of data immediately and place less of a burden on the Heap manager. Small containers require less immediate space, but place more of a burden on the Heap manager.

Large containers can store the following data types immediately and does not require the services of the Heap manager:

Small containers can store the following data types immediately without placing additional burden on the Heap manager:

Analytic Information Server containers can be saved and loaded to and from persistent (database) storage at any time. Containers with immediate data are saved on disk in fixed length records equal to the size of the container. Containers with Heap object references are saved in fixed length records, which are automatically expanded to include the contents of the Heap object, and any objects referenced by the Heap object, etc. This feature is called Object Closure Management and is automatic with every Analytic Information Server container database save. Analytic Information Server containers may be loaded from any database repository record at any time. If the data in the record is immediate, the database load fills the container with the immediate data. If the data in the record is an object closure, the database load fills the container with a Heap object reference, and all of the objects in the record are loaded back into the Heap with the same referential relationships they had when they were saved.


Data Type Functions

The Number object can be demonstrated by the following functions.

(sym)add (sym)div (sym)mul (sym)sub
abs acos add1 addMethod
addi arithmetic asin atan
avg compareEQ compareGE compareGT
compareLE compareLT compareNE compare
comparison cos cosh defmethod
deg divi exp expt
fact floor fraction gcd
imul isEqual isEven isExact
isIdentical isInexact isMoney isNegative
isNull isNumber isOdd isPositive
isType isZero kurtosis log10
log2 log logbase max
median methodsOf min mod
modi money muli nadd
ncompareEQ ncompareGE ncompareGT ncompareLE
ncompareLT ncompareNE ndiv nmod
nmul nsub number pi
product rad random randomize
range ref round send
setq sign sin sinh
sizeof skew sqrt srandom
stdev stdevp sub1 subi
sum sumsqr tan tanh
type var varp


Data Type Examples

The Number object can be demonstrated by the following examples.

Example_Number_ isEven_001 Example_Number_ isExact_001 Example_Number_(sym)add_001 Example_Number_(sym)div_001
Example_Number_(sym)mul_001 Example_Number_(sym)sub_001 Example_Number_abs_001 Example_Number_add1_001
Example_Number_addMethod_014 Example_Number_addi_001 Example_Number_asin_001 Example_Number_atan_001
Example_Number_avg_001 Example_Number_compareEQ_011 Example_Number_compareGE_011 Example_Number_compareGT_011
Example_Number_compareLE_011 Example_Number_compareLT_011 Example_Number_compareNE_011 Example_Number_compare_001
Example_Number_compare_011 Example_Number_comparison_010 Example_Number_cos_001 Example_Number_cosh_001
Example_Number_defmethod_014 Example_Number_deg_001 Example_Number_divi_001 Example_Number_exp_001
Example_Number_expt_001 Example_Number_fact_001 Example_Number_floor_001 Example_Number_fraction_001
Example_Number_isEqual_009 Example_Number_isEven_001 Example_Number_isExact_001 Example_Number_isIdentical_009
Example_Number_isInexact_001 Example_Number_isMoney_001 Example_Number_isNegative_001 Example_Number_isNull_001
Example_Number_isNumber_001 Example_Number_isOdd_001 Example_Number_isPositive_001 Example_Number_isType_013
Example_Number_isZero_001 Example_Number_kurtosis_001 Example_Number_log10_001 Example_Number_log2_001
Example_Number_log_001 Example_Number_logbase_001 Example_Number_max_001 Example_Number_median_001
Example_Number_methodsOf_014 Example_Number_min_001 Example_Number_mod_001 Example_Number_modi_001
Example_Number_muli_001 Example_Number_nadd_001 Example_Number_ncompareGE_001 Example_Number_ncompareGT_001
Example_Number_ncompareLE_001 Example_Number_ncompareLT_001 Example_Number_ndiv_001 Example_Number_nmod_001
Example_Number_nmul_001 Example_Number_nsub_001 Example_Number_number_001 Example_Number_pi_001
Example_Number_product_001 Example_Number_rad_001 Example_Number_random_001 Example_Number_randomize_001
Example_Number_range_001 Example_Number_ref_019 Example_Number_round_001 Example_Number_send_012
Example_Number_setq_018 Example_Number_sign_001 Example_Number_sin_001 Example_Number_sinh_001
Example_Number_sizeof_011 Example_Number_skew_001 Example_Number_sqrt_001 Example_Number_srandom_001
Example_Number_stdev_001 Example_Number_stdevp_001 Example_Number_sub1_001 Example_Number_subi_001
Example_Number_sumsqr_001 Example_Number_tan_001 Example_Number_tanh_001 Example_Number_type_013
Example_Number_var_001 Example_Number_varp_001