Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 216
Dixon Steel Avatar asked Oct 29 '11 21:10

Dixon Steel


2 Answers

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.

like image 115
Matt Ball Avatar answered Oct 23 '22 09:10

Matt Ball


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.

like image 31
Puppy Avatar answered Oct 23 '22 07:10

Puppy