Skip to content
Novus Examples
csv976 B

Shortest Round-Trip Float Representation — 15 vs 16 vs 17 Digits (.csv)

Twelve doubles printed at 15, 16 and 17 significant digits alongside their shortest round-tripping form, with a column recording which precisions actually recover the original bits. Fifteen digits is the default in a lot of formatting code and it loses values, which this table demonstrates rather than asserts.

Preview — first 14 linescsv
value_repr,digits_17g,digits_15g,digits_16g,shortest_round_trips,fifteen_digits_round_trips
0.1,0.10000000000000001,0.1,0.1,true,true
0.2,0.20000000000000001,0.2,0.2,true,true
0.3,0.29999999999999999,0.3,0.3,true,true
0.3333333333333333,0.33333333333333331,0.333333333333333,0.3333333333333333,true,false
0.6666666666666666,0.66666666666666663,0.666666666666667,0.6666666666666666,true,false
3.141592653589793,3.1415926535897931,3.14159265358979,3.141592653589793,true,false
2.718281828459045,2.7182818284590451,2.71828182845905,2.718281828459045,true,false
1.7976931348623157e+308,1.7976931348623157e+308,1.79769313486232e+308,1.797693134862316e+308,true,false
5e-324,4.9406564584124654e-324,4.94065645841247e-324,4.940656458412465e-324,true,true
1234567890.1234567,1234567890.1234567,1234567890.12346,1234567890.123457,true,false
0.30000000000000004,0.30000000000000004,0.3,0.3,true,false
9007199254740992.0,9007199254740992,9.00719925474099e+15,9007199254740992,true,false

Specifications

Rows
12
Columns
6
Digits Compared
15, 16 and 17 significant digits
Rule
17 significant digits always round-trips a float64; 15 does not
Failing At15
8

Testing contract

Reference control
Scenario
Parse each digits_15g and digits_17g string back to float64 and compare against value_repr.
Expected result
All 17-digit strings recover the exact value while 8 of the 15-digit strings do not, matching the fifteen_digits_round_trips column.

What is a .csv file?

CSV (Comma-Separated Values) is a plain-text tabular format where rows are lines and fields are separated by commas, with quoting rules for values that contain delimiters, quotes, or newlines. It has no formal type system and depends on encoding and dialect conventions. It is the most portable format for tabular data exchange.

How to use this file

Use an example CSV to test parsers against quoting and embedded-delimiter edge cases, header handling, encoding detection, and import pipelines into databases or spreadsheets.

How to use this file for testing

“Shortest Round-Trip Float Representation — 15 vs 16 vs 17 Digits (.csv)” is a deterministic Novus Examples fixture for Scientific data, CSV parsing, Editor testing. Citation catalogs (BibTeX, RIS), chemistry structures (MDL Molfile, PDB), and gridded binary data (NetCDF, FITS) — for testing reference managers, molecule viewers, and scientific-data loaders.

Documented properties for this file: 12 rows · 6 columns. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Scientific fixtures are small, valid, and fully synthetic — no real organism, patient, sample, or observation. Point your parser or loader at the file and check it reads the documented records, variables, or headers; binary formats ship a readable twin or metadata listing for comparison.

Code examples

import pandas as pd

df = pd.read_csv("shortest-round-trip-representation.csv")
print(df.head())
print(df.dtypes)

Generated by generation/scientific.py. Free for any use, no attribution required — license.