Jump to content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home

Transition Impacts

Tru64 UNIX Software Transition Kit


» HP STK home
» Home
» Overview
» Tools
» Documentation
» Transition impacts
» Identifier types
» Impact list
» Porting to HP-UX
» Glossary
» Help
» Send us feedback
Site maps
» Tru64 UNIX STK
Content starts here

critical impact:

SIGFPE - floating-point exception differences (CrCh339)

SIG Impacts

Problem description

The default handling mode of floating-point exceptions is different on Tru64 UNIX and HP-UX.

By default, Tru64 UNIX enables traps for invalid operation, division by zero, and overflow exceptions, and disables traps for underflow and inexact exceptions. HP-UX disables traps for all floating-point exceptions by default, which is equivalent to using the -ieee compiler option on Tru64 UNIX.

Applications that handle floating-point exceptions through a SIGFPE signal handler will need to explicitly enable traps for those exceptions on HP-UX. Otherwise, the exceptions will be ignored and the handler will never be invoked for them.


C/C++ Misc. IdentifiersSIGFPE          

See also

Solution description

Enable traps for the appropriate floating-point exceptions.

HP-UX provides the following methods to enable traps for floating-point exceptions:

  • The +FP compiler option allows you to enable traps from the compiler command line. It is available in all HP compilers.

  • The +fp_exception option, available with the HP Fortran 90 compiler, enables traps for four IEEE exceptions: invalid operation, division by zero, overflow, and underflow. (Few programs need to trap for the inexact exception, which occurs often and conveys little information.) The HP FORTRAN/9000 equivalent is +T.

  • The fesettrapenable function is part of the fenv(5) suite and is provided in the C math library.

Review the applicable manpages and HP-UX Floating-Point Guide for more information on floating-point exceptions.

New behavior

The following example uses the +FP compiler option on HP-UX to get the default Tru64 UNIX floating-point exception behavior:

% cc +DD64 +FPOVZ foo.c

The following example accomplishes the same thing using the fesettrapenable function:

#include <fenv.h>

See also

Problem summary

classifications source types OS release severity type
SIG C, C++, Fortran any HP-UX 11i version critical changed
Printable version
Privacy statement Using this site means you accept its terms Feedback to DSPP
© 2007 Hewlett-Packard Development Company, L.P.