简体   繁体   English

C浮点数0x1.fp3

[英]C floating point number 0x1.fp3

From an article: 从一篇文章:

"GNU CC recognizes floating-point numbers written not only in the usual decimal notation, such as 1.55e1, but also numbers such as 0x1.fp3 written in hexadecimal format . In that format the 0x hex introducer and the p or P exponent field are mandatory. The exponent is a decimal number that indicates the power of 2 by which the significand part will be multiplied. Thus 0x1.f is 1 15/16, p3 multiplies it by 8 , and the value of 0x1.fp3 is the same as 1.55e1. " “ GNU CC不仅可以识别以十进制表示的浮点数(例如1.55e1), 还可以识别以十六进制格式编写的数字(例如0x1.fp3) 。在该格式中,0x十六进制介绍和p或P指数字段是指数是一个十进制数字,表示要乘以有效位数的2的幂, 因此0x1.f为1 15/16,p3乘以 8,0x1.fp3的值与1.55e1。”

It seems to say 0x1.fp3 is evaluated as = (1 + 15/16 ) * 2^3 似乎说0x1.fp3被评估为=(1 + 15/16)* 2 ^ 3

Where the 15/16 came from ? 15/16来自哪里?

由于它是十六进制格式,然后0.1意味着1/160.2意味着2/16 ,... 0.a意味着10/16 ,..., 0.f意味着15/16

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM