as computer understands only 0's and 1's underneath,how does floating point numbers like 12.1234 gets represented in memory as a set of 0's and 1's ,
does it gets stored by respective ASCII values of 1 ,2, . ,1,2,3,4 respectively..?
as computer understands only 0's and 1's underneath,how does floating point numbers like 12.1234 gets represented in memory as a set of 0's and 1's ,
does it gets stored by respective ASCII values of 1 ,2, . ,1,2,3,4 respectively..?
As far as I know flaoting numbers(for single precision) are stored in memory as follows:
For example:
3.14159
would be represented like this:Do note that
.
is not stored at all in memory.As a good reference read What Every Computer Scientist Should Know About Floating-Point Arithmetic and Floating Point
Since a computer understands only 0s and 1s, have you ever wondered how it can store emails, pictures, movies, sound? There are 0s and 1s stored. These are interpreted. We assign meaning to bits depending on your purposes.
Google for IEEE 754 for a thorough explanation.