简体   繁体   中英

Float32 and UInt32?

I am looking at some older Apple code for C++, I am familiar with float but not Float32 and Uint32 types are they the same as standard float and ints?

Thanks

UInt32 is a 32-bit (4-byte) unsigned integer. This means that it can represent values in the range
[0, 2^32-1] ( = [0, 4294967295] ).

Float32 is a 32-bit (aka single-precision [contrast with double-precision] ) floating point number .


As other answers have mentioned, the types exist to guarantee the width.

The suffix gives the bit size. This makes them the same if and only if the Standard float and int have the same size on the target machine. They exist to give guaranteed sizes on all platforms.

I suppose they are some typedef respectively for a floating point type and an unsigned integer type guaranteed to be 32 bit wide .

On most platforms they will simply decay to float (at least, on any machine that uses the IEEE 754 standard) and, on 32 bit machines, to unsigned int (on some 64 bit platforms it may decay to unsigned short ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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