Integer Number
representation.numeric.integer_numberWhole number without fractional part. String representation of an integer. Transforms to BIGINT or INTEGER depending on value range.
Shape
^-?[0-9]+$| Value | Length | Shape |
|---|---|---|
| 42 | 2 | matches |
| -17 | 3 | matches |
| 0 | 1 | matches |
| 999999999 | 9 | matches |
Told apart
2 of the 5 other numeric types accept every one of these samples on shape alone.
- Decimal Numbermatches them by pattern
- Percentagematches them by pattern
Going the other way, this type's own rule accepts 1 of 4 samples of Percentage.
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] In programming-language source code, an integer literal is commonly written as a sequence of digits optionally prefixed with + or −.[1]
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] 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] XML Schema 1.1 bounds its long datatype at a minInclusive of -9223372036854775808 and a maxInclusive of 9223372036854775807.[2] RFC 8259, the JSON specification, does not allow leading zeros in a number.[3] The Frictionless Data Table Schema describes its integer field type as containing integers, that is whole numbers.[4]
Use
DuckDB's BIGINT type, also called INT8, INT64 or LONG, holds values from -2^63 to 2^63 - 1 in 8 bytes.[5] DuckDB's INTEGER type, also called INT4, INT32, INT or SIGNED, holds values from -2^31 to 2^31 - 1 in 4 bytes.[5] DuckDB's HUGEINT type, also called INT128, holds values from -2^127 to 2^127 - 1.[5]
RFC 8259 notes that integers in the range [-(2**53)+1, (2**53)-1] are interoperable between JSON implementations.[3] JavaScript's Number.MAX_SAFE_INTEGER is 9007199254740991.[6] Microsoft's support article says Excel has a maximum precision of 15 significant digits.[7] Microsoft's support article says that in Excel any numbers past the 15th digit are rounded down to zero.[7] 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] A prefix 0 is used in C to specify string representations of octal numbers.[8] A leading zero can be a distinguishing character rather than part of a value, as in telephone numbers.[8] 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)secondary source
- [2]W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypesstandard
- [3]RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Formatstandard
- [4]Table Schema | Data Package (v1)standard
- [5]Numeric Typesdocumentation
- [6]Number.MAX_SAFE_INTEGER - JavaScript | MDNdocumentation
- [7]Keeping leading zeros and large numbers | Microsoft Supportdocumentation
- [8]Leading zerosecondary source
Detection notes
v1 migration: Was numeric.integer_number. Converts to BIGINT. Includes negative numbers. Pattern is simple integer format.
In Meridian's open data
- edgar_gleif
keyconfidence 0.55
Use it
$ finetype infer -i "42" --mode column
→ representation.numeric.integer_number
SELECT ft_infer('42');
-- → 'representation.numeric.integer_number'CAST({col} AS BIGINT)Schema
https://meridian.online/schemas/representation.numeric.integer_number · Frictionless type integer
finetype taxonomy representation.numeric.integer_number -o json-schema