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

Floating point precission issues #19

Open
Harvie opened this issue May 19, 2013 · 1 comment
Open

Floating point precission issues #19

Harvie opened this issue May 19, 2013 · 1 comment

Comments

@Harvie
Copy link

Harvie commented May 19, 2013

Please fix working with floating point numbers... maybe use long instead of float? modify printf formating string? Really best thing that you can do is to internally store numbers as strings unless you really need to compute with them. (AFAIK there's no support for adding ar multiplying numbers, etc... jshon is just expected to take nuber on one side and print exact same number on the other end... so just check if it's number and if it is, then just store it as string).

Here's sample problem:

jshon -e e <<<'{"e":200.123456789}'
200.123457

I've also managed to get something like 22.37 translated into 22.370001 or 22.369999, but can't find the exact number which caused the problem right now...

THX for jshon. I've been planning to create something simillar till i find jshon...

@keenerd
Copy link
Owner

keenerd commented Sep 1, 2013

You are absolutely correct, but there does not seem to be a way to get this info out of the jansson library.

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

No branches or pull requests

2 participants