如何使用工会将双重变成64位整数
我想将double
的所有位存储在C中的64位整数中。
即,最重要的位应该是指数,然后是指数,然后是分数。
我想使用工会。
I would like to store all bits of a double
in a 64-bit integer in C.
I.e. the most significant bit should be the sign, after that the exponent, then the fraction.
I would like to use a union.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最安全的方法是使用
memcpy
。如果您没有
memcpy
可以使用,则可以使用Union
:The safest way to do this is to use
memcpy
.If you don't have
memcpy
at your disposal, you can use aunion
: