# Tech Blog – GCC-Pack Floating Point Math Options

The article describes different ways of providing floating point math for programs compiled with GCC-Pack. While floating point math is an integral part of C and C++ standards, it requires hardware and/or software support to work. Standard options provided by GCC itself are described, as well as ones provided in the pack and AmigaOS NDK.

## FPU code

Using a math coprocessor (68881/68882) is the best option in terms of both speed and code size. Compilation for the coprocessor is enabled with the -m68881 option. Basic arithmetic operations are then directly translated into FPU instructions. In addition, this option sets the preprocessor macro __HAVE_68881__. This in turn causes the file <math-68881.h> to be loaded from the header file <math.h>. This file defines standard mathematical functions as macros containing coprocessor assembler instructions.

When using FPU for math, no additional libraries are needed, it also works for linking without stdlib. The obvious disadvantage is that FPU is required. With no additional check, program compiled with -m68881 will crash on machine without FPU.