Skip to content

Conversation

@lordnynex
Copy link
Member

Change maximum allowable precision for encode_number_precision from 14 to 16.

I am experiencing a bug in my application where some client generated sequence numbers are being stored incorrectly due to a loss of precision. As far as I understand, a double has a maximum of 16 decimal places. This module only allows 14.

2015/11/01 01:39:37 [error] 10742#0: *21 lua entry thread aborted: runtime error: ./lib/wiola.lua:10: bad argument #1 to 'encode_number_precision' (expected integer between 1 and 14) 

@agentzh
Copy link
Member

agentzh commented Nov 2, 2015

@lordnynex Will you mind adding a test case to the existing test suite for this? Thanks!

@lordnynex
Copy link
Member Author

@agentzh The tests dir is a little confusing. I added the tests to agentzh.t. Please tell me if this is not the right place.

@agentzh
Copy link
Member

agentzh commented Nov 3, 2015

@lordnynex Yeah, I know t/ is a bit messy atm and sorry about the confusion. Your additions lie in the best place in my mind. Thank you! I'll take care of this as soon as I can.

agentzh pushed a commit that referenced this pull request Nov 4, 2015
thanks lordnynex for the patch in #4.

Test cases for changing precision
agentzh pushed a commit that referenced this pull request Nov 4, 2015
thanks lordnynex for the patch in #4.

Test cases for changing precision
@agentzh
Copy link
Member

agentzh commented Nov 4, 2015

@lordnynex I've applied a slightly modified version of your patch (which fixed a failure in the old test suite). Thanks a lot!

@agentzh agentzh closed this Nov 4, 2015
agentzh pushed a commit that referenced this pull request Nov 4, 2015
… via cjson.encode_number_precision().

thanks lordnynex for the patch in #4.

Test cases for changing precision
hishamhm pushed a commit to hishamhm/lua-cjson that referenced this pull request Jul 12, 2022
Add support compiled to libcjson.a
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

Successfully merging this pull request may close these issues.

2 participants