gpt4 book ai didi

c - 将十六进制值存储在整数中

转载 作者:行者123 更新时间:2023-11-30 16:13:04 25 4
gpt4 key购买 nike

我正在尝试获取浮点值的十六进制表示形式,到目前为止我已经能够完成此任务:

float num = 263.3
int hexInt = *(int*)#
printf("%d", hexInt); // some integer value i dont understand
printf("%x", hexInt); //the hexidecimal represenation of num

我只是好奇整数 hexInt 当格式化为整数时代表什么。

最佳答案

... to get the hexadecimal representation of a floating point value

只需使用“%a\n”

printf("%a\n", 263.3f);  // May print `0x1.074cccp+8

关于c - 将十六进制值存储在整数中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58176356/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com