Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fpsetmask(3C) — DG/UX 5.4.2A

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

isnan(3C)



fpgetround(3C)                   DG/UX 5.4.2                  fpgetround(3C)


NAME
       fpgetround, fpsetround, fpgetmask, fpsetmask, fpgetsticky,
       fpsetsticky - IEEE floating-point environment control

SYNOPSIS
       #include <ieeefp.h>

       fprnd fpgetround ();

       fprnd fpsetround (rnddir)
       fprnd rnddir;

       fpexcept fpgetmask ();

       fpexcept fpsetmask (mask)
       fpexcept mask;

       fpexcept fpgetsticky ();

       fpexcept fpsetsticky (sticky)
       fpexcept sticky;

DESCRIPTION
       There are five floating-point exceptions:  divide-by-zero, overflow,
       underflow, imprecise (inexact) result, and invalid operation.  When a
       floating-point exception is detected, a trap (SIGFPE) occurs only
       when the corresponding mask bit is enabled.  Otherwise, the
       corresponding sticky bit is set and the standard IEEE-specified fixup
       is performed on the result.  These routines let the user control the
       behavior on occurrence of any of these exceptions, as well as the
       rounding mode for floating-point operations.

       fpgetround returns the current rounding mode.  fpsetround sets the
       rounding mode and returns the previous rounding mode.  The
       enumeration type fprnd (defined in <ieeefp.h>) comprises the
       following rounding modes:


       FP_RN        /* round to nearest */

       FP_RP        /* round to plus */

       FP_RM        /* round to minus */

       FP_RZ        /* round to zero (truncate) */

       fpgetmask returns the current exception masks.

       fpsetmask sets the exception masks and returns the previous setting.

       fpgetsticky returns the current exception sticky flags.

       fpsetsticky sets (clears) the exception sticky flags and returns the
       previous setting.



Licensed material--property of copyright holder(s)                         1




fpgetround(3C)                   DG/UX 5.4.2                  fpgetround(3C)


       The type fpexcept is defined in <ieeefp.h>, along with the following
       exception masks:


       FP_X_INV     /* invalid operation exception */

       FP_X_OFL     /* overflow exception */

       FP_X_UFL     /* underflow exception */

       FP_X_DZ      /* divide-by-zero exception */

       FP_X_IMP     /* imprecise (loss of precision) */

       The following defaults are in effect unless your program includes the
       file <ieeefp.h>:

            Rounding mode set to nearest (FP_RN).

          In the COFF environments (see intro(3)), these traps are enabled:

            Divide-by-zero,
            floating-point overflow, and
            invalid operation.

          In the ELF environment (see intro(3)), no traps are enabled.

       If your program includes the file <ieeefp.h>, all traps are disabled.


SEE ALSO
       isnan(3C).

CAUTIONS
       fpsetsticky modifies all sticky flags.  fpsetmask changes all mask
       bits.

       Both C and F77 require truncation (round to zero) for floating-point
       to integral conversions.  The rounding mode has no effect on these
       conversions.

       The sticky bit is never set when the trap for the exception is
       enabled.  As a result, it is currently impossible to determine what
       IEEE floating-point exception occurred from a C-coded signal handler.













Licensed material--property of copyright holder(s)                         2


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026