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

precision problem with double_precision parameter #445

Closed
glaucouri opened this issue Dec 9, 2020 · 3 comments
Closed

precision problem with double_precision parameter #445

glaucouri opened this issue Dec 9, 2020 · 3 comments
Labels
question Further information is requested

Comments

@glaucouri
Copy link

glaucouri commented Dec 9, 2020

Hi all, i'm trying to serialize data from a numeric engine, so i use double_precision=15 because we handle very small numbers,
but i've found a strange behaviour

ujson ver==1.35

> from ujson import dumps
> dumps(0.9999999999999996, double_precision=14)
'1.0'
> dumps(0.9999999999999996, double_precision=15)
'0.1'

It seems related to the value of double_precision.

Is this expected?
Thank you

@hugovk
Copy link
Member

hugovk commented Dec 9, 2020

Please can you retest with the latest version, 4.0.1? And also fix the typos in your example code?

@glaucouri
Copy link
Author

For my use case i can test on py2 env, last available version is 2.0.3.
In this version parameter double_precision is deprecated
the problem doesn't appears any more.

@hugovk hugovk added the question Further information is requested label Dec 10, 2020
@hugovk
Copy link
Member

hugovk commented Dec 10, 2020

Ah yes, that reminds me, it was replaced because there were precision errors, see for example #393 (comment).

(And Python 2's no longer supported.)

@hugovk hugovk closed this as completed Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants