Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: floating-point number serialization issue for non-normal values #992

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

filzrev
Copy link

@filzrev filzrev commented Oct 16, 2024

This PR intended to fix #991.

What's changed in this PR

  • Replace formatter.FormatNumber(object value); call to ToString("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 NumericRegex checks. Instead add IsNaN/IsInfinity checks
  • Add unit test code (SerializationOfNumericsAsJsonRountTrip)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant