Skip to content
Novus Examples
csv422 B

Floating-Point Summation — Five Orders, Five Answers (.csv)

The same 1002 numbers added five different ways, giving results from 0 to 1000 for an exact answer of 1000. Floating-point addition is not associative, and this file is the smallest complete demonstration of what that costs a naive accumulator.

Preview — first 7 linescsv
strategy,result,exact_answer,absolute_error,note
forward (as written),0.0,1000.0,-1000,1e16 absorbs each 1.0 before the -1e16 arrives
reverse order,0.0,1000.0,-1000,"the same values, added the other way"
sorted by magnitude,1000.0,1000.0,+0,smallest first keeps the ones alive
Kahan compensated,1000.0,1000.0,+0,carries the running rounding error
numpy pairwise sum,986.0,1000.0,-14,numpy splits the reduction into blocks

Specifications

Terms
1002
Exact Answer
1000
Strategies
5
Forward Result
0.0
Kahan Result
1000.0
Pairwise Result
986.0
Series
1e16, then 1000 copies of 1.0, then -1e16

Testing contract

Reference control
Scenario
Sum the described series with each of the five strategies and compare your totals against the result column.
Expected result
Forward summation returns 0.0 while Kahan compensation returns 1000.0, and your implementations reproduce each listed result exactly rather than merely approximately.

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

“Floating-Point Summation — Five Orders, Five Answers (.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: CSV · 422 bytes. 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("summation-order-matters.csv")
print(df.head())
print(df.dtypes)

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