blob: 6c979ac5adc40fe6b4ca0e7612c385ee4f4b46d8 [file] [log] [blame]
Eric Fiselier5dddf722019-02-11 23:47:19 +00001// -*- C++ -*-
2//===---------------------------- math.h ----------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_FENV_H
11#define _LIBCPP_FENV_H
12
13
14/*
15 fenv.h synopsis
16
17This entire header is C99 / C++0X
18
19Macros:
20
21 FE_DIVBYZERO
22 FE_INEXACT
23 FE_INVALID
24 FE_OVERFLOW
25 FE_UNDERFLOW
26 FE_ALL_EXCEPT
27 FE_DOWNWARD
28 FE_TONEAREST
29 FE_TOWARDZERO
30 FE_UPWARD
31 FE_DFL_ENV
32
33Types:
34
35 fenv_t
36 fexcept_t
37
38int feclearexcept(int excepts);
39int fegetexceptflag(fexcept_t* flagp, int excepts);
40int feraiseexcept(int excepts);
41int fesetexceptflag(const fexcept_t* flagp, int excepts);
42int fetestexcept(int excepts);
43int fegetround();
44int fesetround(int round);
45int fegetenv(fenv_t* envp);
46int feholdexcept(fenv_t* envp);
47int fesetenv(const fenv_t* envp);
48int feupdateenv(const fenv_t* envp);
49
50
51*/
52
53#include <__config>
54#include_next <fenv.h>
55
56#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
57#pragma GCC system_header
58#endif
59
60#ifdef __cplusplus
61
62extern "C++" {
63
64#ifdef feclearexcept
65_LIBCPP_INLINE_VISIBILITY
66inline int __libcpp_feclearexcept(int __excepts) {
67 return feclearexcept(__excepts);
68}
69#undef feclearexcept
70_LIBCPP_INLINE_VISIBILITY
71inline int feclearexcept(int __excepts) {
72 return ::__libcpp_feclearexcept(__excepts);
73}
74#endif // defined(feclearexcept)
75
76#ifdef fegetexceptflag
77_LIBCPP_INLINE_VISIBILITY
78inline int __libcpp_fegetexceptflag(fexcept_t* __out_ptr, int __excepts) {
79 return fegetexceptflag(__out_ptr, __excepts);
80}
81#undef fegetexceptflag
82_LIBCPP_INLINE_VISIBILITY
83inline int fegetexceptflag(fexcept_t *__out_ptr, int __excepts) {
84 return ::__libcpp_fegetexceptflag(__out_ptr, __excepts);
85}
86#endif // defined(fegetexceptflag)
87
88
89#ifdef feraiseexcept
90_LIBCPP_INLINE_VISIBILITY
91inline int __libcpp_feraiseexcept(int __excepts) {
92 return feraiseexcept(__excepts);
93}
94#undef feraiseexcept
95_LIBCPP_INLINE_VISIBILITY
96inline int feraiseexcept(int __excepts) {
97 return ::__libcpp_feraiseexcept(__excepts);
98}
99#endif // defined(feraiseexcept)
100
101
102#ifdef fesetexceptflag
103_LIBCPP_INLINE_VISIBILITY
104inline int __libcpp_fesetexceptflag(const fexcept_t* __out_ptr, int __excepts) {
105 return fesetexceptflag(__out_ptr, __excepts);
106}
107#undef fesetexceptflag
108_LIBCPP_INLINE_VISIBILITY
109inline int fesetexceptflag(const fexcept_t *__out_ptr, int __excepts) {
110 return ::__libcpp_fesetexceptflag(__out_ptr, __excepts);
111}
112#endif // defined(fesetexceptflag)
113
114
115#ifdef fetestexcept
116_LIBCPP_INLINE_VISIBILITY
117inline int __libcpp_fetestexcept(int __excepts) {
118 return fetestexcept(__excepts);
119}
120#undef fetestexcept
121_LIBCPP_INLINE_VISIBILITY
122inline int fetestexcept(int __excepts) {
123 return ::__libcpp_fetestexcept(__excepts);
124}
125#endif // defined(fetestexcept)
126
127#ifdef fegetround
128_LIBCPP_INLINE_VISIBILITY
129inline int __libcpp_fegetround() {
130 return fegetround();
131}
132#undef fegetround
133_LIBCPP_INLINE_VISIBILITY
134inline int fegetround() {
135 return ::__libcpp_fegetround();
136}
137#endif // defined(fegetround)
138
139#ifdef fesetround
140_LIBCPP_INLINE_VISIBILITY
141inline int __libcpp_fesetround(int __round) {
142 return fesetround(__round);
143}
144#undef fesetround
145_LIBCPP_INLINE_VISIBILITY
146inline int fesetround(int __round) {
147 return ::__libcpp_fesetround(__round);
148}
149#endif // defined(fesetround)
150
151#ifdef fegetenv
152_LIBCPP_INLINE_VISIBILITY
153inline int __libcpp_fegetenv(fenv_t* __envp) {
154 return fegetenv(__envp);
155}
156#undef fegetenv
157_LIBCPP_INLINE_VISIBILITY
158inline int fegetenv(fenv_t* __envp) {
159 return ::__libcpp_fegetenv(__envp);
160}
161#endif // defined(fegetenv)
162
163#ifdef feholdexcept
164_LIBCPP_INLINE_VISIBILITY
165inline int __libcpp_feholdexcept(fenv_t* __envp) {
166 return feholdexcept(__envp);
167}
168#undef feholdexcept
169_LIBCPP_INLINE_VISIBILITY
170inline int feholdexcept(fenv_t* __envp) {
171 return ::__libcpp_feholdexcept(__envp);
172}
173#endif // defined(feholdexcept)
174
175
176#ifdef fesetenv
177_LIBCPP_INLINE_VISIBILITY
178inline int __libcpp_fesetenv(const fenv_t* __envp) {
179 return fesetenv(__envp);
180}
181#undef fesetenv
182_LIBCPP_INLINE_VISIBILITY
183inline int fesetenv(const fenv_t* __envp) {
184 return ::__libcpp_fesetenv(__envp);
185}
186#endif // defined(fesetenv)
187
188#ifdef feupdateenv
189_LIBCPP_INLINE_VISIBILITY
190inline int __libcpp_feupdateenv(const fenv_t* __envp) {
191 return feupdateenv(__envp);
192}
193#undef feupdateenv
194_LIBCPP_INLINE_VISIBILITY
195inline int feupdateenv(const fenv_t* __envp) {
196 return ::__libcpp_feupdateenv(__envp);
197}
198#endif // defined(feupdateenv)
199
200} // extern "C++"
201
202#endif // defined(__cplusplus)
203
204#endif // _LIBCPP_FENV_H