浮点型精度变化bug
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分别处理。 我的联系邮箱:[email protected]
这个是计算机浮点数表示的问题,21.32f,计算机表示就是21.3199999.....的,建议使用string转换,你可以参照:http://blog.163.com/liucy_18/blog/static/5319290620106239333519/
退订
发自网易邮箱大师
在2017年10月16日 16:46,qinliujie[email protected] 写道:
Closed #57.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.