What does byte mean when it says that float has 4 bytes and double has 8 bytes? | SoloLearn: Learn to code for FREE!

0

What does byte mean when it says that float has 4 bytes and double has 8 bytes?

I searched but i still dont quite get it, i think it means how many characters it has but im still not sure

2/7/2020 11:24:11 AM

Odnantiev

3 Answers

New Answer

+4

It's about how many bytes it is required to store the value. float requires 4 bytes ---> float can store 2^(8*4) different values. double requires 8 bytes ---> double can store 2^(8*8) different values.

+4

A byte means 8 bits So float use 4 * 8 = 32 bits to store floating point values. Where as a double use 8 * 8 = 64 bits to store a value Unlike integers floating and double values are further divided into mantissa and exponent to provide a certain range. Read about them here https://en.m.wikipedia.org/wiki/Floating-point_arithmetic

+4

Just to clarify what bits and bytes are- https://www.sololearn.com/Discuss/2090896/?ref=app