# Number

The number type is inhabited by real numeric values.[1] Specifically, it has 53 bits of precision,[2] meaning it can accurately represent integral values in the interval , outside of which arithmetic operations will gradually lose precision. This is because the number type is implemented using double-precision floating-point numbers.

## Non-numeric values

### NaN

**NaN**, which stands for **not a number**, is a special value of the number type. In Lua, it is the only value that is not equal to itself.[3] Some invalid operations, such as `math.sqrt(-1)`

, return this.

### inf

**inf**, which stands for **infinity**, is the largest number Lua can represent. It can be obtained by the use of math.huge or `1/0`

. There also exists **-inf**, obtained by negating another **inf** value.

## References

- Ierusalimschy, Roberto (March 2006).
*Programming in Lua*. p. 29. ISBN 8590379825. - "IEEE Standard for Floating-Point Arithmetic".
*IEEE Std 754-2008*: 1–70. August 2008. doi:10.1109/IEEESTD.2008.4610935. - "Inf And Nan Comparisons".
*lua-users*. 2006-09-30. Retrieved 2018-08-05.

This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.