when the float type is float32_t double float64_t long double float80_t what does that mean | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

when the float type is float32_t double float64_t long double float80_t what does that mean

17th Jul 2016, 12:54 PM
Walter Eke
8 Answers
+ 1
float is 32 bits, double is 64 bits, long double is 80 bits, all of them are used in floating point numbers
17th Jul 2016, 1:50 PM
_Geometry dash_ _Roh_ (AKA NovaRate0315)
_Geometry dash_ _Roh_ (AKA NovaRate0315) - avatar
+ 1
thanks! In which code did you found those 'special' types? It looks like optimisation. Is it from reverse engineering ?
17th Jul 2016, 2:22 PM
Dorian
+ 1
I could easily find them on stack overflow.
17th Jul 2016, 3:38 PM
_Geometry dash_ _Roh_ (AKA NovaRate0315)
_Geometry dash_ _Roh_ (AKA NovaRate0315) - avatar
+ 1
I think the most obvious use is to state the exact size of the data type. This is useful whenever knowing the exact size is important, e.g. for structs that are used for data transmission (also std::uint8_t, std::uint32_t etc.).
17th Jul 2016, 3:45 PM
Stefan
Stefan - avatar
+ 1
Thanks, I thought it was the job of the compiler to adapt the storage size according processor architecture but un many case it must be known before and controled. For ibformation, I'ce already seen similar types on DSP (axoloti).
17th Jul 2016, 4:14 PM
Dorian
+ 1
It is the job of the compiler to determine storage size (in a sense of how many bytes a data type really takes up in memory) as it aligns the values in the memory oftentimes making composed data types as structs, classes or arrays take up more space for the sake of faster, easier access to the data elements. My answer did not include the alignment as I didn't want to complicate things (and alignment / padding seemed a bit too far away from the original question).
17th Jul 2016, 5:14 PM
Stefan
Stefan - avatar
+ 1
@Dorian: float, double are defined in the IEEE standard 754 and have therefore a fixed size they require. int doesn't, as the compiler chooses it to be the size of the architecture you compile for (to make integers as big as possible without losing speed in operations on them).
17th Jul 2016, 5:19 PM
Stefan
Stefan - avatar
+ 1
Yes a decompile source
17th Jul 2016, 9:08 PM
Walter Eke