-
-
Notifications
You must be signed in to change notification settings - Fork 776
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
Number values get rounded #277
Comments
http://stackoverflow.com/a/307200 That's JS restriction, not parser bug. |
Yes, and I pointed that out in the other thread. That said, I respectfully disagree that one should so cavalierly write off confusing and platform-specific behavior in the parsing of a platform-independent format. Arbitrary rounding is not part of the YAML spec and misrepresents the actual value specified. A simple load and dump of any given YAML should create equivalent YAML and this fails that simple test. I would suggest that there are a number of ways this could be handled better including: warnings, errors, or adaptive behavior depending on the actual value in the YAML. |
That may be resonable, but needs an issue with clear suggestion. Current one just says about problem that can not be fixed anyhow. |
@puzrin The main premise of using YAML for configuration files is that they provide static values. Having large integers being rounded without any warnings causes unexpected behaviour, regardless of the fact JS only supports 32bit integer operations. The fix for this would be to interpret it as a string, which is how many other JS Yaml based parsers handle this. |
JS has known limitations, for example with types |
How about handling this adding a option similat to mysql's |
A scalar in the yaml of:
Will be represented as a rounded number value of
8421999999999996000
in the Javascript once parsed.Please see: apigee-127/magic#21 for more information.
Thanks!
The text was updated successfully, but these errors were encountered: