Number
Standard 64-bit floating-point numbers in Internet Object
A Number in Internet Object represents a 64-bit double-precision floating-point value conforming to the IEEE 754 standard. Numbers are scalar primitives used to express integers, fractional values, and special numeric constants.
Numbers in Internet Object support various representations including different bases (binary, octal, hexadecimal), scientific notation, and special values like NaN and Infinity.
Syntax
A number can be expressed in multiple forms:
number = ["-" | "+"] (
decimalNumber
| binaryNumber
| octalNumber
| hexNumber
| scientificNumber
) | specialValue
decimalNumber = digit+ ["." digit+]
binaryNumber = "0b" binaryDigit+
octalNumber = "0o" octalDigit+
hexNumber = "0x" hexDigit+
scientificNumber = (digit+ ["." digit+] | "." digit+) ("e" | "E") ["-" | "+"] digit+
specialValue = "NaN" | "Inf" | "-Inf" | "+Inf"
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
binaryDigit = "0" | "1"
octalDigit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7"
hexDigit = digit | "A" | "B" | "C" | "D" | "E" | "F" | "a" | "b" | "c" | "d" | "e" | "f"Structural Characters
0-9
Digits
Multiple
Standard decimal digits
.
Decimal Point
U+002E
Separates integer and fraction
-
Minus Sign
U+002D
Indicates negative numbers
+
Plus Sign
U+002B
Optional positive indicator
e/E
Exponent
Multiple
Scientific notation exponent
0b
Binary Prefix
Multiple
Binary number indicator
0o
Octal Prefix
Multiple
Octal number indicator
0x
Hex Prefix
Multiple
Hexadecimal number indicator
Valid Forms
Decimal Base Number
Numbers in decimal format can include integers and fractional values, with optional sign prefixes:
A decimal number consists of one or more digits, optionally preceded by a sign (+ or -), and optionally including a decimal point followed by one or more digits.
Alternative Bases
Numbers can be expressed in binary, octal, or hexadecimal notation:
Binary Numbers (Base-2)
Binary representation uses 0b or 0B prefix followed by binary digits (0-1):
Octal Numbers (Base-8)
Octal representation uses 0o or 0O prefix followed by octal digits (0-7):
Hexadecimal Numbers (Base-16)
Hexadecimal representation uses 0x or 0X prefix followed by hex digits (0-9, A-F):
Case Sensitivity
Prefixes: Both lowercase (
0b,0o,0x) and uppercase (0B,0O,0X) are supportedHex digits: Both uppercase (
A-F) and lowercase (a-f) are valid
Scientific Notation
Scientific notation expresses numbers using exponential form with e or E:
Scientific Notation Components
Mantissa: The significant digits (before
e/E)Exponent marker:
eorE(case insensitive)Exponent: The power of 10 (can be positive, negative, or zero)
Optional Behaviors
Literal and Alternate Forms
Numbers support multiple equivalent representations:
Invalid Forms
Preservation of Structure
Internet Object preserves:
The chosen representation form (decimal, binary, octal, hex, scientific)
Whitespace (non-significant in interpretation)
Syntactic fidelity (as written, except that an explicit plus sign is not preserved)
However, it does not interpret:
Mathematical relationships between values
Precision requirements beyond IEEE 754
Domain-specific numeric constraints
Such semantics are the responsibility of the schema layer, validators, or application logic.
See Also
Number Types Overview - Launcher for all number types and formats
BigInt - For arbitrary-precision integers
Decimal - For fixed-precision decimal arithmetic
Special Numeric Values - NaN and Infinity
Last updated
Was this helpful?
