Scientific Notation
representation.numeric.scientific_notationNumber in scientific notation (e.g., 1.23e-4, 5E+6, 3.14e10). Transforms to DOUBLE.
Worked samples
DuckDB 1.5.5 · finetype 0.6.64
| Value | As DOUBLE | exponent | mantissa |
|---|---|---|---|
| 1.23e-4 | 0.000123 | -4 | 1.23 |
| 5E+6 | 5000000.0 | 6 | 5.0 |
| 3.14e10 | 31400000000.0 | 10 | 3.14 |
| -2.5e-3 | -0.0025 | -3 | -2.5 |
Shape
^-?[0-9]+(\.[0-9]+)?[eE][+-]?[0-9]+$| Value | Length | Shape |
|---|---|---|
| 1.23e-4 | 7 | matches |
| 5E+6 | 4 | matches |
| 3.14e10 | 7 | matches |
| -2.5e-3 | 7 | matches |
| 1.23e- | 6 | rejected: one character short |
Told apart
1 of the 5 other numeric types accept every one of these samples on shape alone.
- Decimal Numbermatches them by pattern
Going the other way, this type's own rule accepts 2 of 6 samples of Decimal Number.
Background
Origin
In E notation, the letter E or e stands for exponent and is read as times ten raised to the power of.[1] E notation comes from Fortran and was present in the first version of Fortran, released for the IBM 704 in 1956.[1] The developers of the SHARE Operating System for the IBM 709 were already using E notation in 1958.[1] ALGOL 60 took a different route, writing a subscript ten character in place of the letter E.[1] The first pocket calculators to support scientific notation appeared in 1972.[1]
In normalised scientific notation, called standard form in the United Kingdom, the exponent is chosen so that the absolute value of the leading number is at least one and less than ten.[1] Engineering notation differs from normalised scientific notation by restricting the exponent to multiples of 3.[1]
Use
JSON's number grammar in RFC 8259 includes an exponent part that begins with the letter E in uppercase or lowercase, optionally followed by a plus or minus sign.[2] Python's float() accepts an exponent written as e or E, with an optional sign, after leading and trailing whitespace is removed.[3] DuckDB's documentation says non-integer numeric literals can be written in E notation, giving 1e2 as 100 and 6.02214e23 as Avogadro's constant.[4]
Microsoft Excel's General format uses exponential notation for large numbers of 12 or more digits.[5] Microsoft's example shows a 2-decimal scientific format displaying 12345678901 as 1.23E+10.[5] Excel's maximum limit for number precision is 15 digits.[5] When a column of long identifiers, such as account or barcode numbers, arrives as values like 1.23E+10, treat it as a sign that a spreadsheet touched the file and go back to the original export rather than casting it. (Meridian's view)
IEEE 754 double precision gives from 15 to 17 significant decimal digits of precision.[6] RFC 8259 notes that a JSON number such as 1E400 may indicate potential interoperability problems.[2]
Sources
- [1]Scientific notationsecondary source
- [2]RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format | RFC Editorstandard
- [3]Built-in functions — Python 3.15.0 documentationdocumentation
- [4]Literal Typesdocumentation
- [5]Display numbers in scientific (exponential) notation | Microsoft Supportdocumentation
- [6]Double-precision floating-point formatsecondary source
Detection notes
v1 migration: New for v2. Covers scientific notation like 1.23e-4. Decompose extracts mantissa and exponent.
Use it
$ finetype infer -i "1.23e-4" --mode column
→ representation.numeric.scientific_notation
SELECT ft_infer('1.23e-4');
-- → 'representation.numeric.scientific_notation'CAST({col} AS DOUBLE)Schema
https://meridian.online/schemas/representation.numeric.scientific_notation · Frictionless type number
finetype taxonomy representation.numeric.scientific_notation -o json-schema