Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fpgetround(3C) — Dell System V Release 4 Issue 2.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

isnan(3C)



fpgetround(3C)         UNIX System V(C Development Set)          fpgetround(3C)


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

SYNOPSIS
      #include <ieeefp.h>

      fprnd fpgetround (void);

      fprnd fpsetround (fprnd rnddir);

      fpexcept fpgetmask (void);

      fpexcept fpsetmask (fpexcept mask);

      fpexcept fpgetsticky (void);

      fpexcept fpsetsticky (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 occurs, the corresponding sticky bit is set (1),
      and if the mask bit is enabled (1), the trap takes place.  These routines
      let the user change the behavior on occurrence of any of these
      exceptions, as well as change the rounding mode for floating-point
      operations.

           FPXINV  /* invalid operation exception */
           FPXOFL  /* overflow exception */
           FPXUFL  /* underflow exception */
           FPXDZ        /* divide-by-zero exception */
           FPXIMP  /* imprecise (loss of precision) */
           FPRN     /* round to nearest representative number */
           FPRP     /* round to plus infinity */
           FPRM     /* round to minus infinity */
           FPRZ     /* round to zero (truncate) */

      fpgetround returns the current rounding mode.

      fpsetround sets the rounding mode and returns the previous rounding mode.

      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.




10/89                                                                    Page 1







fpgetround(3C)         UNIX System V(C Development Set)          fpgetround(3C)


      The default environment is rounding mode set to nearest (FPRN) and all
      traps disabled.

      Individual bits may be examined using the constants defined in ieeefp.h.

SEE ALSO
      isnan(3C).

NOTES
      fpsetsticky modifies all sticky flags.  fpsetmask changes all mask bits.
      fpsetmask clears the sticky bit corresponding to any exception being
      enabled.

      C requires truncation (round to zero) for floating point to integral
      conversions.  The current rounding mode has no effect on these
      conversions.

      One must clear the sticky bit to recover from the trap and to proceed.
      If the sticky bit is not cleared before the next trap occurs, a wrong
      exception type may be signaled.


































Page 2                                                                    10/89





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