Welcome to mirror list, hosted at ThFree Co, Russian Federation.

fesetenv.c « mingwex « mingw « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c8f07613e5e2b21a0a9988b405eccc79318bc327 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <fenv.h>

/* 7.6.4.3
   The fesetenv function establishes the floating-point environment
   represented by the object pointed to by envp. The argument envp
   points to an object set by a call to fegetenv or feholdexcept, or
   equal the macro FE_DFL_ENV or an implementation-defined environment
   macro. Note that fesetenv merely installs the state of the exception
   flags represented through its argument, and does not raise these
   exceptions.
 */

int fesetenv (const fenv_t * envp)
{
  if (envp == FE_PC64_ENV)
/*
 *  fninit initializes the control register to 0x37f,
 *  the status register to zero and the tag word to 0FFFFh.
 *  The other registers are unaffected.
 */
    __asm__ ("fninit");

  else if (envp == FE_PC53_ENV)
/*
 * MS _fpreset() does same *except* it sets control word
 * to 0x27f (53-bit precison).
 */
    _fpreset();

  else
    __asm__ ("fldenv %0;" : : "m" (*envp));
  return 0;
}