# Integer Number

Key: `representation.numeric.integer_number`

Whole number without fractional part. String representation of an integer. Transforms to BIGINT or INTEGER depending on value range.

Page: <https://meridian.online/docs/projects/finetype/types/representation/numeric/integer_number>

Samples: `42`, `-17`, `0`, `999999999`

## Background

### Origin

In computer science, an integer is a datum of integral data type, a data type that represents some range of mathematical integers.[[1]](https://en.wikipedia.org/wiki/Integer_%28computer_science%29) In programming-language source code, an integer literal is commonly written as a sequence of digits optionally prefixed with + or −.[[1]](https://en.wikipedia.org/wiki/Integer_%28computer_science%29)

W3C's XML Schema 1.1 Part 2 defines integer as derived from decimal by fixing the value of fractionDigits to be 0 and disallowing the trailing decimal point.[[2]](https://www.w3.org/TR/xmlschema11-2/) XML Schema 1.1 gives integer a lexical representation of a finite-length sequence of one or more decimal digits with an optional leading sign.[[2]](https://www.w3.org/TR/xmlschema11-2/) XML Schema 1.1 bounds its long datatype at a minInclusive of -9223372036854775808 and a maxInclusive of 9223372036854775807.[[2]](https://www.w3.org/TR/xmlschema11-2/) RFC 8259, the JSON specification, does not allow leading zeros in a number.[[3]](https://www.rfc-editor.org/rfc/rfc8259) The Frictionless Data Table Schema describes its integer field type as containing integers, that is whole numbers.[[4]](https://specs.frictionlessdata.io/table-schema/)

### Use

DuckDB's BIGINT type, also called INT8, INT64 or LONG, holds values from -2^63 to 2^63 - 1 in 8 bytes.[[5]](https://duckdb.org/docs/current/sql/data_types/numeric.html) DuckDB's INTEGER type, also called INT4, INT32, INT or SIGNED, holds values from -2^31 to 2^31 - 1 in 4 bytes.[[5]](https://duckdb.org/docs/current/sql/data_types/numeric.html) DuckDB's HUGEINT type, also called INT128, holds values from -2^127 to 2^127 - 1.[[5]](https://duckdb.org/docs/current/sql/data_types/numeric.html)

RFC 8259 notes that integers in the range \[-(2\*\*53)+1, (2\*\*53)-1\] are interoperable between JSON implementations.[[3]](https://www.rfc-editor.org/rfc/rfc8259) JavaScript's Number.MAX\_SAFE\_INTEGER is 9007199254740991.[[6]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER) Microsoft's support article says Excel has a maximum precision of 15 significant digits.[[7]](https://support.microsoft.com/topic/1bf7b935-36e1-4985-842f-5dfa51f85fe7) Microsoft's support article says that in Excel any numbers past the 15th digit are rounded down to zero.[[7]](https://support.microsoft.com/topic/1bf7b935-36e1-4985-842f-5dfa51f85fe7) When a long run of digits arrives from a JSON API or a spreadsheet export, compare it against the original before trusting the last few digits. (Meridian's view)

Microsoft's support article says Excel automatically removes leading zeros.[[7]](https://support.microsoft.com/topic/1bf7b935-36e1-4985-842f-5dfa51f85fe7) A prefix 0 is used in C to specify string representations of octal numbers.[[8]](https://en.wikipedia.org/wiki/Leading_zero) A leading zero can be a distinguishing character rather than part of a value, as in telephone numbers.[[8]](https://en.wikipedia.org/wiki/Leading_zero) Before casting a column of digits to an integer, ask whether it is a quantity you would add up or a code you would look up; codes such as postal codes, account numbers and identifiers are better kept as text. (Meridian's view)

## Sources

1. [Integer (computer science)](https://en.wikipedia.org/wiki/Integer_%28computer_science%29) — secondary source
2. [W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes](https://www.w3.org/TR/xmlschema11-2/) — standard
3. [RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format](https://www.rfc-editor.org/rfc/rfc8259) — standard
4. [Table Schema \| Data Package (v1)](https://specs.frictionlessdata.io/table-schema/) — standard
5. [Numeric Types](https://duckdb.org/docs/current/sql/data_types/numeric.html) — documentation
6. [Number.MAX\_SAFE\_INTEGER - JavaScript \| MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER) — documentation
7. [Keeping leading zeros and large numbers \| Microsoft Support](https://support.microsoft.com/topic/1bf7b935-36e1-4985-842f-5dfa51f85fe7) — documentation
8. [Leading zero](https://en.wikipedia.org/wiki/Leading_zero) — secondary source
