TOC | Prev | Next

Floats

Floating point numbers are numbers with a decimal point.

float-specs.c

/* From C in a Nutshell, page 27 */
#include <stdio.h>
#include <float.h>

int main( void ) {
    printf( "Storage size            = %lu bytes\n", sizeof( float ) );
    printf( "Smallest possible value = %E\n", FLT_MIN );
    printf( "Largest  possible value = %E\n", FLT_MAX );
    printf( "Precision               = %d decimal digits\n", FLT_DIG );

    return 0;
}

$ float-specs

Storage size            = 4 bytes
Smallest possible value = 1.175494E-38
Largest  possible value = 3.402823E+38
Precision               = 6 decimal digits
TOC | Prev | Next