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

maximum encode_number_precision value #80

Open
rexxar-liang opened this issue Dec 24, 2021 · 3 comments
Open

maximum encode_number_precision value #80

rexxar-liang opened this issue Dec 24, 2021 · 3 comments

Comments

@rexxar-liang
Copy link

for the latest code, I found the maximum value of encode_number_precision is 16, which is merged in commit.
f79aa68

For our scenes, we use int64 value in json strings, which means 16 precission numbers is not enough for us.

So any suggestions?
Can we change max value of encode_number_precision to 19, 20 or add new configuration like cjson.max_encode_number_precision(X) for different scenes?

Thanks.

@rexxar-liang
Copy link
Author

From here, it seems the lua_cjson only support double type, and do not support int64 or uint64.
https://github.com/openresty/lua-cjson/blob/master/lua_cjson.c#L662
image

Do we have any plan to support larger number?
the lua_number in lua5.4 can be long double.
image

@kevinw66
Copy link

Sample problem here.
We are using Long type in java, and cjson cannot decode it correctly

@wanrui
Copy link

wanrui commented Nov 16, 2023

因为luajit number 类型不能表示int64,可以使用字符串进行处理

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

3 participants