Floating Point Data Types
Floating point
types can contain decimal numbers, for example 1.23, -.087. There are three
sizes, float (single-precision), double (double-precision) and long double
(extended-precision). Some examples:
floatcelsius = 37.623;
doublefahrenheit = 98.415;
long double accountBalance =
1897.23;
The range of
values that can be stored in each of these is defined by your compiler.
Typically double will hold a greater range than float and long double will hold
a greater range than double but this may not always be true. However, we can be
sure that double will be at least as great as float and may be greater, and
long double will be at least as great as double and may be greater.
No comments:
Post a Comment