### 9.2 DEC Alpha options ¶

The DEC Alpha processor has default settings which maximize floating-point performance, at the expense of full support for IEEE arithmetic features.

Support for infinity arithmetic and gradual underflow (denormalized numbers) is not enabled in the default configuration on the DEC Alpha processor. Operations which produce infinities or underflows will generate floating-point exceptions (also known as traps), and cause the program to terminate, unless the operating system catches and handles the exceptions (which is, in general, inefficient). The IEEE standard specifies that these operations should produce special results to represent the quantities in the IEEE numeric format.

In most cases the DEC Alpha default behavior is acceptable, since the majority of programs do not produce infinities or underflows. For applications which require these features, GCC provides the option `-mieee` to enable full support for IEEE arithmetic.

To demonstrate the difference between the two cases the following program divides 1 by 0:

    #include <stdio.h>

    int
    main (void)
    {
      double x = 1.0, y = 0.0;
      printf ("x/y = %g\n", x / y);
      return 0;
    }

In IEEE arithmetic the result of 1/0 is `inf` (Infinity). If the program is compiled for the Alpha processor with the default settings it generates an exception, which terminates the program:

    $ gcc -Wall alpha.c
    $ ./a.out
    Floating point exception    (on an Alpha processor)

Using the `-mieee` option ensures full IEEE compliance – the division 1/0 correctly produces the result `inf` and the program continues executing successfully:

    $ gcc -Wall -mieee alpha.c
    $ ./a.out
    x/y = inf

Note that programs which generate floating-point exceptions run more slowly when compiled with `-mieee`, because the exceptions are handled in software rather than hardware.