With -fast, the compiler is free to replace calls to floating point functions with equivalent optimized code that does not set the errno variable. Further, -fast also defines the macro __MATHERR_ERRNO_DONTCARE, which allows the compiler to ignore ensuring the validity of errno. As a result, user code that relies on the value of errno after a floating point function call could produce inconsistent results.
One way around this problem is to avoid compiling such codes with -fast. However, if -fast optimization is required and the code depends on the value of errno being set properly after floating-point library calls, you should compile with the options
-xbuiltin=none -U__MATHERR_ERRNO_DONTCARE -xnolibmopt -xnolibmil
following -fast on the command line to inhibit the compiler from optimizing out such library calls and to insure that errno is handled properly.