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

浮点型精度变化bug #57

Closed
miaoyoumeng opened this issue Jun 17, 2014 · 2 comments
Closed

浮点型精度变化bug #57

miaoyoumeng opened this issue Jun 17, 2014 · 2 comments

Comments

@miaoyoumeng
Copy link

dubbo远程调用带HashMap参数时,如果HashMap中的值是float类型,那么在provider方接受到的对应参数值将发生变化。
例如,rpc请求发送参数:
HashMap<String, Object> contentMap = new HashMap<String, Object>();
contentMap.put("price", Float.valueOf(21.32f));
那么在provider方接受到的对应的“price”值为:21.31999969482422。
我们对这个问题的修改方案是在BasicSerializer类的writeObject方法的FLOAT和DOUBLE分别处理。
我的联系邮箱:miaoyoumeng@gmail.com

@enson16855
Copy link

这个是计算机浮点数表示的问题,21.32f,计算机表示就是21.3199999.....的,建议使用string转换,你可以参照:http://blog.163.com/liucy_18/blog/static/5319290620106239333519/

@RylanStar
Copy link

RylanStar commented Oct 16, 2017 via email

shareblitz pushed a commit to shareblitz/incubator-dubbo that referenced this issue Dec 19, 2018
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

4 participants