CSV/text export: integers below 2^53 keep every digit

Writing every General number as & converts it rounded 16-digit integers such as card and order numbers to 1.23456789012346E+15, so opening a CSV and saving it again changed the data. Integers that f64 holds exactly (|x| < 2^53) are now written with all their digits, as before; larger integers and non-integers keep the 15-significant-digit & text.
This commit is contained in:
Local contributor committed 2026-10-14 08:23:36 -04:00
1 parent 9331dbb474
commit 4dd4ff9a93
3 files changed
+27 -7

No files matched your search

+2 -2
View File
@@ -41,7 +41,7 @@ and repair-free opening remain unverified.
| Format | Excel | GridCraft read | GridCraft write | Notes |
|---|---|---|---|---|
| `.csv` UTF-8 / Windows / Mac / MS-DOS | R/W | yes (UTF-8 and UTF-16 BOMs, UTF-8, Windows-1252 fallback; delimiter detection) | yes (UTF-8 without BOM, CRLF; a file opened as CSV is saved with the separator it was read with, so a `;` file stays `;`; otherwise `,`) | Formatted numbers and formula results are written as displayed, as in Excel (never column-width `#####`). **Intentional difference:** Excel writes a General number as the cell displays it (`1.24412E+11`, `0.333333333`); GridCraft writes it to 15 significant digits, as `&` converts it (`124412140710`, `0.333333333333333`), so part codes survive a round trip. The same applies to a coloured or sectioned General (`[Blue]General`, `General;[Red]-General`) and to a number in a Text (`@`) cell. No encoding choice on save. Re-import of a single-column export splits text (#127). A used range that would write more than 512 MiB (two far-apart cells span the whole rectangle) is refused with an error instead of being expanded (#528). |
| `.csv` UTF-8 / Windows / Mac / MS-DOS | R/W | yes (UTF-8 and UTF-16 BOMs, UTF-8, Windows-1252 fallback; delimiter detection) | yes (UTF-8 without BOM, CRLF; a file opened as CSV is saved with the separator it was read with, so a `;` file stays `;`; otherwise `,`) | Formatted numbers and formula results are written as displayed, as in Excel (never column-width `#####`). **Intentional difference:** Excel writes a General number as the cell displays it (`1.24412E+11`, `0.333333333`); GridCraft writes an integer below 2^53 (which f64 holds exactly) with all its digits (`124412140710`, `1234567890123456`), so part, card and order numbers survive a round trip, and any other number to 15 significant digits, as `&` converts it (`0.333333333333333`, `1.23456789012346E+16`). The same applies to a coloured or sectioned General (`[Blue]General`, `General;[Red]-General`) and to a number in a Text (`@`) cell. No encoding choice on save. Re-import of a single-column export splits text (#127). A used range that would write more than 512 MiB (two far-apart cells span the whole rectangle) is refused with an error instead of being expanded (#528). |
| `.txt` tab-delimited, Unicode text | R/W | yes (`.txt`, `.tsv`, `.tab`) | yes (displayed values, with General numbers as for `.csv`) | Text Import Wizard options partly via Text to Columns |
| `.prn` formatted text (space-delimited) | R/W | no | no | |
| `.dif`, `.slk` (SYLK) | R/W | no | no | Small, legacy |
@@ -83,7 +83,7 @@ refresh. Counted under features (Get & Transform, ~10% ready), not here.
| Date | Change | Summary |
|---|---|---|
| 2026-10-13 | minor | CSV/text export writes General numbers as `&` converts them (15 significant digits: `0.3`, not `0.30000000000000004`) also through coloured or sectioned General and Text formats (`[Blue]General` still wrote `1.24412E+11`). Duplicate CSV/text rows merged. Intentional difference from Excel, which writes the cell display |
| 2026-10-13 | minor | CSV/text export writes General numbers as `&` converts them (15 significant digits: `0.3`, not `0.30000000000000004`; integers below 2^53 keep every digit) also through coloured or sectioned General and Text formats (`[Blue]General` still wrote `1.24412E+11`). Duplicate CSV/text rows merged. Intentional difference from Excel, which writes the cell display |
| 2026-10-12 | trivial | XLSX chart sheets are kept on save (#727) |
| 2026-10-12 | trivial | CSV and TSV export is capped at 512 MiB and refuses a larger used range with an error (#528) |
| 2026-10-12 | minor | `.xls` import reads the calculation settings (CalcMode, CalcIter, CalcCount, CalcDelta, CalcPrecision), so circular models calculate instead of showing `#CIRC!` (#724) |