About Numbers in DScript
Floating point numbers
All numbers in DScript are stored and manipulated in 8-byte IEEE floating-point number format. The largest number you can enter is ±1.7976931348623157×10308. The smallest number is ±1×10-307.
As you probably expect, you enter a number literal simply by typing its digits. For example:
Enter negative numbers by placing a Minus sign (-) in front of the number.
See Minus.
For example:
You can enter a Plus sign (+) in front of positive numbers if you want to do so for clarity. However, a Plus sign is never required.
See Plus.
For very large or small numbers, you will find it most convenient to enter number literals using scientific notation:
A number in scientific notation has the format
which is equivalent to n1×10n2. For example, 2.1e6 is the same as 2.1×106, or 2,100,000.
Although you can display numbers using 000 digit separators (e.g., 1,500.00), you should never enter a comma in the number literal because commas are used to separate arguments in a function. For example, F(1,500) means to call the function F with two arguments (1 and 500), not one argument with a value of 1,500.
Similarly, you can display negative numbers in parentheses instead of using a negative sign. However, parentheses have a special meaning in DScript, so they should not be used to indicate sign in number literals.
Depending on the country in which you live, you may not use a period as the decimal point and a comma as the list separator. If this is so, DScript has probably already detected your computer settings and adapted to your usual style of entering numbers.
Integers
In some programming languages, integers and floating-point numbers are very different. In DScript, there is no difference at all. Even if you enter a number without any decimal component, the number is stored as a floating-point number and all arithmetic operations are performed as though the number is a floating point.
There is one exception to this rule. Bitwise operators, such as Bitwise And and Bitwise Or, convert numbers to 32-bit integers before performing their operations, then convert the results back to floating point numbers.
See Bitwise And.
See Bitwise Or.
Since all integers are converted to floating point numbers, it is possible trailing digits for very large numbers are lost. DScript can exactly represent integers as large as ±9,007,199,254,740,992 (53-bit).
Hexadecimal numbers
Integers can be entered as hexadecimal (base 16) values.
To enter a hexadecimal number, enter a zero followed by the character x and a sequence of digits. Each digit must be a number (0-9) or a letter (A-F or a-f). For example:
Advanced numbers
In DScript, the notion of what constitutes a number is rather complex. Numbers can contain both real and imaginary components (complex numbers). In addition, any numeric quantity can be assigned units of measure.