Skip to content

Commit

Permalink
Fix canonical format for floating values.
Browse files Browse the repository at this point in the history
Amend the canonical rule for serialising floating point values with UP
TO 3 digits after the decimal point AS NEEDED.

That is, if more than 3 digits would be needed to write the value, then
the writer MUST truncate after the third digit, but if the value can be
written (without loss of precision) with less than 3 digits, the writer
MUST NOT right-pad the value with zeroes.

So a value like 0.9 is to be written as "0.9", NOT as "0.900".
  • Loading branch information
gouttegd committed Jul 4, 2024
1 parent 5c92f94 commit f20e919
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/docs/spec-formats-tsv.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ When writing the metadata block, a canonical SSSOM/TSV writer:
When writing the mappings block, a canonical SSSOM/TSV writer:

* MUST quote values only when needed, as per the rules in the [Quoting](#quoting) section;
* MUST serialise floating point values with three digits after the decimal point, rounding the last digit to the nearest neighbour (rounding up if both neighbours are equidistant);
* MUST serialise floating point values with up to three digits as needed after the decimal point, rounding the last digit to the nearest neighbour (rounding up if both neighbours are equidistant);
* MUST write the columns in the order the slots appear in the [“Slots” table](Mapping.md#slots), in the documentation for the `Mapping` class;
* MUST sort the mappings in lexicographical order on all their slots, in the order the slots appear in the [“Slots” table](Mapping.md#slots).

Expand Down

0 comments on commit f20e919

Please sign in to comment.