A Number is any whole or decimal, positive or negative number. It is further categorised into Integers ("whole" numbers), and Floats (a floating-point, or real, number). Numbers can only be specified in base-10 (decimal). They can be preceded by a sign symbol (+
or -
) to set the sign of the number (note that the sign symbols are also the Number typecast operators).
For example:
{ a = 123 // An integer } { a = 0 // An integer } { a = -4 // An integer } { b = 1.45 // A float } { b = 0.0 // A float } { b = -9.6 // A float }
Numbers in standard form, such as -5.4e7
and 4E-11
can be used by converting them from strings, for instance +"4E-11"
. See Converting to Number below.
To explicitly convert a value to Number, the Number typecast operator - +
- should be used (+
converts as-is, whereas -
converts to Number and also reverses the sign). Some operators, such as the numerical multiplication operator - *
- also explictly convert a value to Number.
When converting to Number: