博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
uint64转double精度会丢失
阅读量:4198 次
发布时间:2019-05-26

本文共 197 字,大约阅读时间需要 1 分钟。

默认隐式转换 uint64 到 double,会出现精度丢失的情况,

经过测试发现采用下面方法就不会有问题

 

double UInt64ToDouble(uint64 uValue)

{

    int64 n64Value = (int64)uValue;

    double dbValue = (double)n64Value;

    return dbValue;

}

 

反向转换也是要显式的类似强转这样的操作

转载地址:http://djzli.baihongyu.com/

你可能感兴趣的文章
【数据库之mysql】mysql的安装(一)
查看>>
【数据库之mysql】 mysql 入门教程(二)
查看>>
【HTML5/CSS/JS】A list of Font Awesome icons and their CSS content values(一)
查看>>
【HTML5/CSS/JS】<br>与<p>标签区别(二)
查看>>
【HTML5/CSS/JS】开发跨平台应用工具的选择(三)
查看>>
【心灵鸡汤】Give it five minutes不要让一个好主意随风而去
查看>>
【React Native】Invariant Violation: Application AwesomeProject has not been registered
查看>>
【ReactNative】真机上无法调试 could not connect to development server
查看>>
【ReactNative/JS】uint8array转string convert uint8array to string
查看>>
【XCode 4.6】常用快捷键 特别是格式化代码ctrl+i
查看>>
【iOS游戏开发】icon那点事 之 实际应用(二)
查看>>
【iOS游戏开发】icon那点事 之 图标设计(三)
查看>>
【IOS游戏开发】之测试发布(Distribution)
查看>>
【IOS游戏开发】之IPA破解原理
查看>>
【一天一道LeetCode】#45. Jump Game II
查看>>
【一天一道LeetCode】#46. Permutations
查看>>
【一天一道LeetCode】#47. Permutations II
查看>>
【一天一道LeetCode】#48. Rotate Image
查看>>
【一天一道LeetCode】#56. Merge Intervals
查看>>
【一天一道LeetCode】#57. Insert Interval
查看>>