skystrife / cpptoml

cpptoml is a header-only library for parsing TOML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception: Numbers may not have leading zeros

D-Alex opened this issue · comments

The toml specifications is not allowing leading zeros even for the exponent of scientific numbers violating C99 standard. The result is an inconsistency between the toml writer which follows C99 and the toml reader.

A workaround is to force the writer to use a fixed floating field.
stream << std::fixed << std::setprecision(9);

A better solution would be to relax the standard and follow C99 which is widely used.

This is a related discussion relaxing the toml specification to allow reading scientific numbers written by C based languages:
toml-lang/toml#356