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

proposal:去掉定点数 #104

Open
xjdrew opened this issue Dec 7, 2021 · 1 comment
Open

proposal:去掉定点数 #104

xjdrew opened this issue Dec 7, 2021 · 1 comment

Comments

@xjdrew
Copy link
Contributor

xjdrew commented Dec 7, 2021

有两个问题:

  1. 目前c/lua版本的实现不正确:现在定点数的内部实现,是用double,还是会丢失精度,并没有正确实现定点数。c23 会增加 Decimal floating-point types (https://en.cppreference.com/w/c/23) ,真有定点数的需求,可以考虑用decimal重新实现。

  2. 与double类型功能重合了。sproto目前已经支持double,可以取代定点数。当移植到go这种强类型语言时,很纠结到底用double还是decimal(第三方类型)表示定点数。如果使用double表示定点数,和c/lua版本一致,但本质上和double其实也没区别了。

@cloudwu
Copy link
Owner

cloudwu commented Dec 7, 2021

double 表示定点数并不丢失精度。

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