YamlDotNet
YamlDotNet copied to clipboard
fix: floating-point number serialization issue for non-normal values
This PR intended to fix #991.
What's changed in this PR
- Replace
formatter.FormatNumber(object value);call toToString("G", CultureInfo.InvariantCulture).- It's required to serialize special symbols (Nan/PositiveInfinite/NegativeInfinite) to JSON compatible string representation.
- Additionally explicitly specify format (
G) to align YAML serialized value
- Remove
NumericRegexchecks. Instead addIsNaN/IsInfinitychecks - Add unit test code (SerializationOfNumericsAsJsonRountTrip)