xref: /netbsd-src/sys/arch/hppa/include/fenv.h (revision 5b588e717defa4466188d141e5ed16760eb0f437)
1*5b588e71Smartin /*	$NetBSD: fenv.h,v 1.2 2015/01/13 11:15:29 martin Exp $	*/
2dce8d6f5Smartin 
3dce8d6f5Smartin /*-
4dce8d6f5Smartin  * Copyright (c) 2014 The NetBSD Foundation, Inc.
5dce8d6f5Smartin  * All rights reserved.
6dce8d6f5Smartin  *
7dce8d6f5Smartin  * Redistribution and use in source and binary forms, with or without
8dce8d6f5Smartin  * modification, are permitted provided that the following conditions
9dce8d6f5Smartin  * are met:
10dce8d6f5Smartin  * 1. Redistributions of source code must retain the above copyright
11dce8d6f5Smartin  *    notice, this list of conditions and the following disclaimer.
12dce8d6f5Smartin  * 2. Redistributions in binary form must reproduce the above copyright
13dce8d6f5Smartin  *    notice, this list of conditions and the following disclaimer in the
14dce8d6f5Smartin  *    documentation and/or other materials provided with the distribution.
15dce8d6f5Smartin  *
16dce8d6f5Smartin  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17dce8d6f5Smartin  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18dce8d6f5Smartin  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19dce8d6f5Smartin  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20dce8d6f5Smartin  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21dce8d6f5Smartin  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22dce8d6f5Smartin  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23dce8d6f5Smartin  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24dce8d6f5Smartin  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25dce8d6f5Smartin  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26dce8d6f5Smartin  * SUCH DAMAGE.
27dce8d6f5Smartin  *
28dce8d6f5Smartin  */
29dce8d6f5Smartin 
30dce8d6f5Smartin #ifndef	_HPPA_FENV_H_
31dce8d6f5Smartin #define	_HPPA_FENV_H_
32dce8d6f5Smartin 
33dce8d6f5Smartin #include <sys/stdint.h>
34*5b588e71Smartin 
35*5b588e71Smartin typedef unsigned fenv_t;
36*5b588e71Smartin typedef unsigned fexcept_t;
37*5b588e71Smartin 
38*5b588e71Smartin #define	FE_INEXACT	0x01	/* imprecise (loss of precision) */
39*5b588e71Smartin #define	FE_UNDERFLOW	0x02	/* underflow exception */
40*5b588e71Smartin #define	FE_OVERFLOW	0x04	/* overflow exception */
41*5b588e71Smartin #define	FE_DIVBYZERO	0x08	/* divide-by-zero exception */
42*5b588e71Smartin #define	FE_INVALID	0x10	/* invalid operation exception */
43*5b588e71Smartin 
44*5b588e71Smartin #define	FE_ALL_EXCEPT	0x1f
45*5b588e71Smartin 
46*5b588e71Smartin #define	FE_TONEAREST	(0)	/* round to nearest representable number */
47*5b588e71Smartin #define	FE_TOWARDZERO	(1<<9)	/* round to zero (truncate) */
48*5b588e71Smartin #define	FE_UPWARD	(2<<9)	/* round toward positive infinity */
49*5b588e71Smartin #define	FE_DOWNWARD	(3<<9)	/* round toward negative infinity */
50*5b588e71Smartin 
51dce8d6f5Smartin 
52dce8d6f5Smartin __BEGIN_DECLS
53dce8d6f5Smartin 
54dce8d6f5Smartin /* Default floating-point environment */
55dce8d6f5Smartin extern const fenv_t	__fe_dfl_env;
56dce8d6f5Smartin #define	FE_DFL_ENV	(&__fe_dfl_env)
57dce8d6f5Smartin 
58dce8d6f5Smartin __END_DECLS
59dce8d6f5Smartin 
60dce8d6f5Smartin #endif	/* !_HPPA_FENV_H_ */
61