xref: /haiku/headers/posix/arch/m68k/fenv.h (revision 0fae96c5a349db3761ac2a4ab4a7fbbf23a3b76c)
1 /*
2  * Copyright (c) 2005-2019 Rich Felker, et al.
3  *
4  * Part of MUSL, released under the MIT license.
5  */
6 
7 
8 #ifndef _FENV_H_
9 #define _FENV_H_
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #if __HAVE_68881__ || __mcffpu__
16 
17 #define FE_INEXACT    8
18 #define FE_DIVBYZERO  16
19 #define FE_UNDERFLOW  32
20 #define FE_OVERFLOW   64
21 #define FE_INVALID    128
22 
23 #define FE_ALL_EXCEPT 0xf8
24 
25 #define FE_TONEAREST  0
26 #define FE_TOWARDZERO 16
27 #define FE_DOWNWARD   32
28 #define FE_UPWARD     48
29 
30 #else
31 
32 #define FE_ALL_EXCEPT 0
33 #define FE_TONEAREST  0
34 
35 #endif
36 
37 typedef unsigned fexcept_t;
38 
39 typedef struct {
40 	unsigned __control_register, __status_register, __instruction_address;
41 } fenv_t;
42 
43 #define FE_DFL_ENV      ((const fenv_t *) -1)
44 
45 int feclearexcept(int);
46 int fegetexceptflag(fexcept_t *, int);
47 int feraiseexcept(int);
48 int fesetexceptflag(const fexcept_t *, int);
49 int fetestexcept(int);
50 
51 int fegetround(void);
52 int fesetround(int);
53 
54 int fegetenv(fenv_t *);
55 int feholdexcept(fenv_t *);
56 int fesetenv(const fenv_t *);
57 int feupdateenv(const fenv_t *);
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 #endif
63 
64