Numeric Data Types

ViviFire supplies many numeric data types to use numbers with different formats. Integer types show as whole numbers, while non-integer types can show numbers with a fractional part.

To compare all the ViviFire data types, see Data Type Summary.

Integer types

The signed integer data types are Int8 (8-bit), Int16 (16-bit), Int32 (32-bit), Int64 (64-bit), Int128 (128-bit), and Int (platform-controlled).

The unsigned integer data types are UInt8 (8-bit), UInt16 (16-bit), UInt32 (32-bit), UInt64 (64-bit), UInt128 (128-bit), and UInt (platform-controlled).

Performance

Arithmetic operations are faster with integer types than with other data types. They are fastest with the types Int and UInt in ViviFire.

Large integers

TODO

Small integers

If the full range of Int is more than what is necessary, then Int16 is a possible alternative. The type Int16 holds integer values in the range −32,768 thru 32,767. For the smallest integer range, the type Int8 holds values from −128 thru 127.

Some code uses a large number of variables to hold small integers. If your code uses the types Int16 and Int8 for its variables, then the runtime can possibly decrease the memory used. But operations with Int16 and Int8 are usually slower than with Int.

Unsigned integers

If you know that a variable must not hold a negative value, then the unsigned types are available. The unsigned types are UInt8, UInt16, UInt32, UInt, UInt64, and UInt128. Each of these data types can hold a positive integer two times larger than the related signed type (Int8, Int16, Int32, Int, Int64, and Int128). The performance of each unsigned type is the same as the related signed type. Thus, UInt and Int have the same very good performance.

Non-integer types

The non-integer numeric data types are Fixed64 (64-bit fixed-point), Fixed128 (128-bit fixed-point), Real32 (32-bit floating-point), Real64 (64-bit floating-point), Real128 (128-bit floating-point), and Real (platform-controlled).

Performance

TODO

Small magnitudes

TODO

Small fractional numbers

TODO

See also