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 requests the compiler ignore ensuring the validity of errno and floating-point exceptions raised. As a result, user code that relies on the value of errno or an appropriate floating-point exception 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 following options
-xbuiltin=none -U__MATHERR_ERRNO_DONTCARE -xnolibmopt -xnolibmil
These options should follow -fast on the command line to inhibit the compiler from optimizing out such library calls and to ensure that errno is handled properly.