GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
fpucw-wrappers.c
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2016-2017 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 // The fpucw macros are provided by gnulib. We don't include gnulib
24 // headers directly in Octave's C++ source files to avoid problems that
25 // may be caused by the way that gnulib overrides standard library
26 // functions.
27 
28 #if defined (HAVE_CONFIG_H)
29 # include "config.h"
30 #endif
31 
32 #if defined (HAVE_FPU_CONTROL_H)
33 # include <fpu_control.h>
34 #endif
35 
36 #include "fpucw.h"
37 
38 #include "fpucw-wrappers.h"
39 
40 #if ! defined (_FPU_DEFAULT)
41 # if defined __i386__ || defined __x86_64__
42 # define _FPU_DEFAULT 0x037f
43 # else
44 # define _FPU_DEFAULT 0
45 # endif
46 #endif
47 
48 void
50 {
51  fpucw_t cw = GET_FPUCW ();
52 
53  if (cw != _FPU_DEFAULT)
54  SET_FPUCW (_FPU_DEFAULT);
55 }
56 
57 // OLDCW is the name used by the fpucw.h macros.
58 
59 unsigned int
61 {
62  fpucw_t oldcw = 0;
63 
64  BEGIN_LONG_DOUBLE_ROUNDING ();
65 
66  return oldcw;
67 }
68 
69 void
70 octave_end_long_double_rounding (unsigned int oldcw)
71 {
72  END_LONG_DOUBLE_ROUNDING ();
73 }
void octave_set_default_fpucw(void)
void octave_end_long_double_rounding(unsigned int oldcw)
#define _FPU_DEFAULT
unsigned int octave_begin_long_double_rounding(void)