Back to index

glibc  2.9
feholdexcpt.c File Reference
#include <fenv_libc.h>

Go to the source code of this file.


int feholdexcept (fenv_t *envp)

Function Documentation

int feholdexcept ( fenv_t envp)

Definition at line 23 of file feholdexcpt.c.

  fenv_union_t old, new;

  /* Save the currently set exceptions.  */
  old.fenv = *envp = fegetenv_register ();

  /* Clear everything except for the rounding modes and non-IEEE arithmetic
     flag.  */
  new.l[1] = old.l[1] & 7;
  new.l[0] = old.l[0];
  /* If the old env had any eabled exceptions, then mask SIGFPE in the
     MSR FE0/FE1 bits.  This may allow the FPU to run faster because it
     always takes the default action and can not generate SIGFPE. */
  if ((old.l[1] & 0x000000F8) != 0)
    (void)__fe_mask_env ();

  /* Put the new state in effect.  */
  fesetenv_register (new.fenv);

  return 0;

Here is the call graph for this function: