-
Notifications
You must be signed in to change notification settings - Fork 168
Add a way of disabling exponential notation when encoding doubles #374
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
base: main
Are you sure you want to change the base?
Conversation
|
Very nice, thanks for the PR! I'll take a look shortly. |
|
Could you please address the failing CI jobs? Missing documentation comments and SwiftLint rule violations. Also CMake updates. |
| public var mappingStyle: Node.Mapping.Style = .any | ||
|
|
||
| /// Set the style for formatting doubles | ||
| public static var doubleFormatStyle: NumberFormatStyle = .scientific |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A static var is not compatible with Swift 6 language mode. If we refactor this as an instance variable we can revitalize this PR.
lynchsft
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A static var is not compatible with Swift 6 language mode. If we refactor this as an instance variable we can revitalize this PR.
|
Any chance to revive this PR? |
lynchsft
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see comment dated Feb 24.
|
Oh, my mistake, I looked at the previous comment dated Jan 2023 and somehow assumed the next one from Feb was also from 2023 :D. |
Closes #279
In current version all doubles are encoded in a scientific notation:
produces:
6.85e+0The proposed change is to add a static option to
Emitter.Optionsclass, so it can be used as follows:which produces the expected result:
6.85YAMLEncoderobject is also supported, as well as numbers with zero fraction part, which are not saved as integers. For example, the following code:generates the expected result:
6.0