Summary
ktoml parses all TOML floats into Double, which loses the original text representation. Scientific notation 5e+22 may become 50000000000000000000000.0 after round-trip. While the value is preserved, the representation is not.
This is analogous to how ktoml already tracks IntegerRepresentation (DECIMAL, HEX, OCTAL, BINARY) for TomlLong — but no such tracking exists for floats.
Affected toml-test cases (2)
Found via toml-lang/toml-test compliance suite:
valid/float/exponent.toml — scientific notation values
valid/spec-1.0.0/float-0.toml — mix of decimal and scientific
Suggested fix
Add a FloatRepresentation enum (DECIMAL, SCIENTIFIC) similar to IntegerRepresentation, and store it in TomlDouble. The writer uses it to choose the output format.
Related: #32, #373
Summary
ktoml parses all TOML floats into
Double, which loses the original text representation. Scientific notation5e+22may become50000000000000000000000.0after round-trip. While the value is preserved, the representation is not.This is analogous to how ktoml already tracks
IntegerRepresentation(DECIMAL, HEX, OCTAL, BINARY) forTomlLong— but no such tracking exists for floats.Affected toml-test cases (2)
Found via
toml-lang/toml-testcompliance suite:valid/float/exponent.toml— scientific notation valuesvalid/spec-1.0.0/float-0.toml— mix of decimal and scientificSuggested fix
Add a
FloatRepresentationenum (DECIMAL, SCIENTIFIC) similar toIntegerRepresentation, and store it inTomlDouble. The writer uses it to choose the output format.Related: #32, #373