Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C - <b>float single-precision floating-point data type</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
float                    Single-Precision Floating-Point Data Type

    The float type declares an object to be of "single-precision"
    floating-point type.  The size (and representation) of a float object
    is implementation-defined.  A float is the same or less in size than
    a double.

      Notes:    In MS-C, the size of a float object is four bytes.  It
                uses the IEEE representation consisting of a sign bit, a
                7-bit excess 127 binary exponent, and a 24-bit mantissa.
                The mantissa represents a number between 1.0 and 2.0;
                since the high-order bit of the mantissa is always 1, it
                is not stored in the number.  The range of values is
                approximately 3.4E-38 to 3.4E+38.

                All floating-point constants have type double. There is
                no way to specify a float constant.

                Since all floating-point arithmetic is performed in
                double-precision, and all float expressions used as
                function arguments are promoted to type double, it might
                appear you would have little use for type float.  Floats,
                however, require only four storage bytes, whereas doubles
                requires eight.  The decision between float and double is
                one of space versus run-time conversion cost.

                The type long float is a synonym for the type double. It
                has nothing to do with the float type.

  -------------------------------- Example ---------------------------------

           float value = 1.234;
           float f1 = 1.234E-24;

           value = (float) 123;

See Also: Types double long

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson