Number Type
Numbers in TMBASIC are decimal
floating-point numbers.
This means that all numbers are stored using the scientific notation,
A * 10^B.
For example, the number 456 can be written as
4.56 * 10^2.
In this notation,
A is called the "significand" and
B is called the "exponent."
In TMBASIC, the significand has one digit to the left of the decimal point (the whole number) and up to 33 digits to the right (the fraction).
The exponent may be any integer from -6143 to 6144.
The
IEEE 754 standard calls this representation
"decimal128" because it uses 128 bits (or 16 bytes) of storage.
Literal decimals can be written directly, as in the following example.
dim x as Number
x = 5
x = -9.1
Algebraic operators like
+ (plus) and
- (minus) perform mathematical operations on numbers.
dim x = 5 * 10
dim y = x / 4
dim z = -y
Comparison operators like
< (less than) and
> (greater than) produce
Boolean values that allow you to make decisions.
dim x = 50
dim y = x < 100
if x > 10 then
print "Greater!"
end if