c++ - printf 数据输出问题
ringa_lee
ringa_lee 2017-04-17 13:55:09
0
3
576
ringa_lee
ringa_lee

ringa_lee

reply all(3)
Ty80

%x placeholder is used to output unsigned integer type. You are definitely wrong to use it to output floating point type.

左手右手慢动作

You can refer to: http://www.cplusplus.com/reference/cstdio/printf/

x: is an unsigned hexadecimal integer

Your first step has been to convert 0x00000001 to float


Update for you:

%X should not be the hexadecimal value of the output data

Although it is hexadecimal, integers are the key points

Your f1 is float

float f1 = 0x00000001;

迷茫

The underlying operation of floating-point numbers is different from that of integers. When floating-point numbers are operated, they have their own independent floating-point stack. Each register of the floating-point stack has 80 bits. The result used by printf("%x") is a direct floating-point number. Outbound results (results are expressed in 64 bits), so not 32 bits

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template