Skip to main content



12345678901longlong since out of range for int
NaNdoubleNot a number
NaN(double)doubleNot a number
NaN(float)floatNot a number
InfdoubleGoing into infinity in the positive direction
+InfdoubleSame as Inf
-InfdoubleGoing into infinity in the negative direction

To construct a decimal without precision loss, convert from a string as in decimal("12345.123"). The remaining constructors may lead to loss of precision if the destination type is less precise than the source.

All operations described implicitly convert numbers to the most precise type following the type hierarchy:

byte < short < int < long < float < double < decimal.

NOTE: Overflows are not checked by default. To protect against overflow, either choose an appropriate type that is large enough to accommodate the operation or use the overflow-safe version of the operators, which always checks for overflows.



To know if an expression is NaN (not a number), it is not possible to compare it with equality, since the result is always false. Instead use:

nan IS NAN // true
ISNAN(nan) // Same as nan IS NAN
1 IS NAN // false


Number types can be casted to:

  • other number types, which may result in loss of precision if the final type is less precise than the original type;
  • boolean, where zero becomes false whilst every other number is true;
  • string, which creates a string representation of the number.

Casting nan to a natural number (int, long, byte, short) will result in 0.

Casting inf to int or long will result in the maximum value of the respective type. Similarly, casting -inf to int or long will result in the minimum value of the respective type.

Casting inf and -inf to short or byte will result in an overflow.