# Decimal Number

Key: `representation.numeric.decimal_number`

Number with decimal point (e.g., 3.14, -0.5, 1000.001), optionally with scientific-notation suffix (e.g., 6e-04, 1.5E+10). String representation of a floating-point number. Transforms to DOUBLE.

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

Samples: `3.14`, `-0.5`, `1000.001`, `0.0001`, `6e-04`, `1.5E+10`

## Background

### Origin

The 22nd General Conference on Weights and Measures declared in 2003 that the symbol for the decimal marker shall be either the point on the line or the comma on the line.[[1]](https://www.bipm.org/en/committees/cg/cgpm/22-2003/resolution-10)[[2]](https://en.wikipedia.org/wiki/Decimal_separator) In 1958, disputes between European and American delegates over the correct representation of the decimal separator nearly stalled the development of the ALGOL programming language.[[2]](https://en.wikipedia.org/wiki/Decimal_separator) Most computer languages and standard data formats, among them C, Java, Fortran and CSS, specify a dot as the decimal separator.[[2]](https://en.wikipedia.org/wiki/Decimal_separator)

The E notation for a power of ten, as in 6.022E23, comes from Fortran and was present in the first version released for the IBM 704 in 1956.[[3]](https://en.wikipedia.org/wiki/Scientific_notation) In E notation the letter E or e stands for exponent and is read as times ten raised to the power of.[[3]](https://en.wikipedia.org/wiki/Scientific_notation)

The first IEEE standard for floating-point arithmetic, IEEE 754-1985, was published in 1985.[[4]](https://en.wikipedia.org/wiki/IEEE_754) The current version of the IEEE floating-point standard, IEEE 754-2019, was published in July 2019.[[4]](https://en.wikipedia.org/wiki/IEEE_754)

### Use

RFC 8259, the JSON specification, defines a number as an optional minus sign, an integer part, an optional fraction and an optional exponent.[[5]](https://www.rfc-editor.org/rfc/rfc8259) RFC 8259 says that an exponent part begins with the letter E in uppercase or lowercase, which may be followed by a plus or minus sign.[[5]](https://www.rfc-editor.org/rfc/rfc8259) RFC 8259 does not allow leading zeros in a JSON number.[[5]](https://www.rfc-editor.org/rfc/rfc8259) RFC 8259 does not permit numeric values such as Infinity and NaN.[[5]](https://www.rfc-editor.org/rfc/rfc8259) The Frictionless Table Schema number type allows an optional exponent made of an E followed by an optional + or - sign and one or more decimal digits.[[6]](https://specs.frictionlessdata.io/table-schema/)

Python's documentation shows that 0.1 + 0.1 + 0.1 == 0.3 evaluates to False.[[7]](https://docs.python.org/3/tutorial/floatingpoint.html) IEEE 754 binary64 values contain 53 bits of precision, according to Python's documentation.[[7]](https://docs.python.org/3/tutorial/floatingpoint.html) DuckDB's documentation says its DOUBLE type typically has a range of around 1E-307 to 1E+308 with a precision of at least 15 digits.[[8]](https://duckdb.org/docs/current/sql/data_types/numeric.html) DuckDB's documentation advises using the DECIMAL data type for exact storage of numbers with a known number of decimal digits, such as monetary amounts.[[8]](https://duckdb.org/docs/current/sql/data_types/numeric.html) DuckDB's default DECIMAL width and scale, when none are given, is DECIMAL(18, 3).[[8]](https://duckdb.org/docs/current/sql/data_types/numeric.html) A cast to a double is the right default for measurements, coordinates and scores, but money, quantities with a fixed number of places and identifiers that merely look numeric deserve a DECIMAL or a string instead. (Meridian's view)

### Where you'll meet it

The US Geological Survey's CSV feed of significant earthquakes writes latitude, longitude and magnitude as decimal numbers with a point as the separator.[[9]](https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_month.csv)

## Sources

1. [resolution 10 - BIPM](https://www.bipm.org/en/committees/cg/cgpm/22-2003/resolution-10) — standard
2. [Decimal separator](https://en.wikipedia.org/wiki/Decimal_separator) — secondary source
3. [Scientific notation](https://en.wikipedia.org/wiki/Scientific_notation) — secondary source
4. [IEEE 754 - Wikipedia](https://en.wikipedia.org/wiki/IEEE_754) — secondary source
5. [RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format](https://www.rfc-editor.org/rfc/rfc8259) — standard
6. [Table Schema \| Data Package (v1)](https://specs.frictionlessdata.io/table-schema/) — standard
7. [15\. Floating-Point Arithmetic: Issues and Limitations](https://docs.python.org/3/tutorial/floatingpoint.html) — documentation
8. [Numeric Types](https://duckdb.org/docs/current/sql/data_types/numeric.html) — documentation
9. [significant\_month.csv](https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_month.csv) — dataset
