From f20e919b43bf7dd58c8b6e6e0b7fea06c899b9a9 Mon Sep 17 00:00:00 2001 From: Damien Goutte-Gattat Date: Thu, 4 Jul 2024 21:41:27 +0100 Subject: [PATCH] Fix canonical format for floating values. 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". --- src/docs/spec-formats-tsv.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs/spec-formats-tsv.md b/src/docs/spec-formats-tsv.md index 4f0b822a..6a12dc7f 100644 --- a/src/docs/spec-formats-tsv.md +++ b/src/docs/spec-formats-tsv.md @@ -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).