Numbers
You can enter a number into an expression using any available number formats in (see Number formats), including:
2008, 12.345, 0.00123, 5.3E20, 5.3E-20, $100,000
Suffix format uses a letter or symbol suffix to denote a power of ten, such as:
25K, 200M, 123p, 20%
Suffix format provides a simple, familiar way to specify large or small numbers. See Suffix characters for details.
You can usually enter numbers using most number format types directly into an expression no matter what number format was specified for the variable defined by the expression. The exceptions are:
- You may use commas to separate groups of three digits, such as
123,456.00
, only if the expression consists of that single number. If the number is part of an expression with other elements, such as12*123,456
, you may not use comma separators because the syntax would be ambiguous. You should use simply12*123456
. - Dates, date-times, or times-of-day must be typed in a very specific format when the number format is not set to date, or when they appear within an expression with other elements. See Date and Time Values.
Integers, Fixed Point and Floating Point: Integer values that you enter between -9,223,372,036,854,775,807
and 9,223,372,036,854,775,807
are represented internally as integers, and numbers that you enter between -9,223,372,036,854.775807
and 9,223,372,036,854.775807
with 6 or fewer decimals are represented internally with full precision as fixed-point numbers. Numbers with more than 6 decimal digits of precision or outside these ranges are represented using 64-bit binary floating point numbers.
Precision: Integer and fixed-point numbers are exact representations of the numeric value, and hence, Analytica prefers these representations when possible. Floating point values are, in general, approximate values, accurate to about 15 significant digits. Many base-10 floating point numbers cannot be represented exactly in binary, and hence may have some rounding error in the 16th digit.
Round-off error: Some calculations, especially those that involve small differences between large numbers or large numbers of additions, might result in less precision than this maximum, or may magnify existing round-off error.
When calculations are performed with integer or fixed-point numbers, the result is represented internally as an integer or fixed-point number if Analytica is able to do so, which it usually is able to do with addition, subtraction, and multiplication. These results have zero round-off error. With many other operations, such as division or functions like Sqrt(), this is not possible, so the result is floating point number. Operations involving floating-point numbers result in floating-point numbers even if the result appears to be an integer, since the result is no longer guaranteed exact, and always subject to the possibility that round-off error could accumulate.
Largest and smallest numbers: Analytica can represent positive numbers between about 10-320 and 1.797x10308. If a calculation would result in a number smaller than about 10-320, it rounds it down zero:
1/10^1000 → 0
If the result would be larger than 1.797x10308 it returns INF
(infinity):
10^1000 → INF
For more, see Exception values INF, NAN, and NULL.
Complex Numbers: To enter the imaginary part of a complex number, append a lowercase j or i to the number, as in these examples
1j, -1-1j, -2M+23Kj, 4-7e-8j
In the 4-7e-8j
example, the imaginary part is -7e-8
(i.e., -70n
). There cannot be a space between the digit and the j, and if you want just the imaginary number, you must write 1i
or 1j
, since without the preceding 1, you would be referring to a variable named i
or j
.
The real and imaginary components are both represented internally as 32-bit floating point numbers, each spanning the range from 3.4e+38
to 3.4e-38
with about 7 digits of precision. A complex number consumes the same amount of memory as a real number, but sacrifices range and precision to do so. As a result, you will experience greater round-off error in calculations that use complex numbers.
Hexadecimal and Binary integers: You can type an integer is base-16 (hexadecimal) by prefixing it with 0x
and using the digits 0-9 and a-f. For example, 0xa503
is the number 42,243
. You can enter a binary number by prefixing it with 0b
and then using the digits 0 and 1. For example, 0b101010
is 42
. There cannot be any space, comma or other character between the prefix and the digits, or between digits.
See Also
- Number formats
- Number Format Dialog
- NumberFormat attribute
- IsNumber
- Not a Number
- INF, NAN, and Null
- INF, NAN, and NULL - Exception values
- IsNaN
- IsNull
- Complex Numbers
- EnableComplexNumbers
- Complex number functions
- Binary and hexadecimal integer formats
- ReadBinaryFile
- WriteBinaryFile
- BitAnd
- Numbers and text
- Converting Numbers to Text
- NumberToText
- ParseNumber
- Round
- Numeric Tolerance and Precision
- Number type function parameters
- Numeric variables
- Integer() variable specification function
- Math functions
- Objects and Values
- Multiple formats in one table
Enable comment auto-refresher