Hey am Junaid, in this post I will explain you about the c programming floating point datatypes. As you know in my last post C programming Datatypes. Where I has explained you about the c programming datatypes. There is major heading which is basic datatypes. Basic datatype is divided into two parts. One part is integer datatype and other one is floating point datatype.
Floating point datatype is covering all the arithmetic values which have floating point. Like 9.99 is the float type data. Floating point datatype having the range of values which they can stored only. Which mean they have some limitations and restrictions.
|Type||Storage size||Value range||Precision|
|float||4 byte||1.2E-38 to 3.4E+38||6 decimal places|
|double||8 byte||2.3E-308 to 1.7E+308||15 decimal places|
|long double||10 byte||3.4E-4932 to 1.1E+4932||19 decimal places|
In this table I have mentioned the ranges of floating point datatypes and their storage size according to the precision. It will helps you much to understand the facts of floating point types data.
You can use anyone of datatype according to your conditions. I have sample code for declaring each type of floating point datatype.
long double three;
When you write like this, compiler understands that you have declared these variables for the use. In the code about variables are “one” type of float, “two” type of double, “three” type of long double.
I hope it will very helpful for you to understand the floating point datatype. In c programming floating point datatype is play important role. Because the beginner programmers initially given the mathematical problems to solved with programs. In which floating points datatype used the most. If you have any question you can ask me freely. You can also join my Facebook group to share your views.