Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates numeric handling in CsToml by switching float parsing to Utf8Parser.TryParse and refactoring decimal serialization/deserialization to use TomlDocumentNode.TryGetDouble plus a new Utf8TomlDocumentWriter.WriteDecimal helper, with added test coverage for float boundaries and generated decimal types.
Changes:
- Update
TomlFloat.Parseto useSystem.Buffers.Text.Utf8Parser.TryParse. - Add
Utf8TomlDocumentWriter.WriteDecimaland use it fromDecimalFormatter/NullableDecimalFormatter. - Add/extend tests for float boundary values and generator-driven
decimalserialization/deserialization.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/CsToml.Tests/DefaultTest.cs | Adds additional float boundary tests (max/min/epsilon, exponents, negative zero). |
| tests/CsToml.Generator.Tests/Generator/TypeDecimalTest.cs | New generator tests for decimal serialization/deserialization, including many edge cases. |
| tests/CsToml.Generator.Tests/Declarations/TypeDeclarations.cs | Adds a generated TypeDecimal model for generator tests. |
| src/CsToml/Values/TomlFloat.cs | Switches float parsing to Utf8Parser.TryParse. |
| src/CsToml/Utf8TomlDocumentWriter.cs | Adds WriteDecimal(decimal) implementation. |
| src/CsToml/Formatter/DecimalFormatter.cs | Refactors decimal formatter to deserialize via TryGetDouble and serialize via WriteDecimal. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Merged
This was referenced May 13, 2026
This was referenced May 25, 2026
This was referenced Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR change
TomlFloatandDecimalFormatterprocess.Change:
This change was created by Claude Code.