1*7e30e943Schs /* $NetBSD: fenv.c,v 1.2 2017/03/22 23:11:09 chs Exp $ */ 292e958deSchristos 392e958deSchristos /*- 492e958deSchristos * Copyright (c) 2015 The NetBSD Foundation, Inc. 592e958deSchristos * All rights reserved. 692e958deSchristos * 792e958deSchristos * This code is derived from software contributed to The NetBSD Foundation 892e958deSchristos * by Christos Zoulas. 992e958deSchristos * 1092e958deSchristos * Redistribution and use in source and binary forms, with or without 1192e958deSchristos * modification, are permitted provided that the following conditions 1292e958deSchristos * are met: 1392e958deSchristos * 1. Redistributions of source code must retain the above copyright 1492e958deSchristos * notice, this list of conditions and the following disclaimer. 1592e958deSchristos * 2. Redistributions in binary form must reproduce the above copyright 1692e958deSchristos * notice, this list of conditions and the following disclaimer in the 1792e958deSchristos * documentation and/or other materials provided with the distribution. 1892e958deSchristos * 1992e958deSchristos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2092e958deSchristos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2192e958deSchristos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2292e958deSchristos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2392e958deSchristos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2492e958deSchristos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2592e958deSchristos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2692e958deSchristos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2792e958deSchristos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2892e958deSchristos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2992e958deSchristos * POSSIBILITY OF SUCH DAMAGE. 3092e958deSchristos */ 3192e958deSchristos #include <sys/cdefs.h> 32*7e30e943Schs __RCSID("$NetBSD: fenv.c,v 1.2 2017/03/22 23:11:09 chs Exp $"); 33*7e30e943Schs 34*7e30e943Schs #include "namespace.h" 3592e958deSchristos 3692e958deSchristos #define __fenv_static 37*7e30e943Schs #include <fenv.h> 38*7e30e943Schs 39*7e30e943Schs #ifdef __weak_alias 40*7e30e943Schs __weak_alias(feclearexcept,_feclearexcept) 41*7e30e943Schs __weak_alias(fedisableexcept,_fedisableexcept) 42*7e30e943Schs __weak_alias(feenableexcept,_feenableexcept) 43*7e30e943Schs __weak_alias(fegetenv,_fegetenv) 44*7e30e943Schs __weak_alias(fegetexcept,_fegetexcept) 45*7e30e943Schs __weak_alias(fegetexceptflag,_fegetexceptflag) 46*7e30e943Schs __weak_alias(fegetround,_fegetround) 47*7e30e943Schs __weak_alias(feholdexcept,_feholdexcept) 48*7e30e943Schs __weak_alias(feraiseexcept,_feraiseexcept) 49*7e30e943Schs __weak_alias(fesetenv,_fesetenv) 50*7e30e943Schs __weak_alias(fesetexceptflag,_fesetexceptflag) 51*7e30e943Schs __weak_alias(fesetround,_fesetround) 52*7e30e943Schs __weak_alias(fetestexcept,_fetestexcept) 53*7e30e943Schs __weak_alias(feupdateenv,_feupdateenv) 54*7e30e943Schs #endif 5592e958deSchristos 5692e958deSchristos #if defined(__GNUC_GNU_INLINE__) && !defined(__lint__) 5792e958deSchristos #error "This file must be compiled with C99 'inline' semantics" 5892e958deSchristos #endif 5992e958deSchristos 6092e958deSchristos extern inline int feclearexcept(int __excepts); 6192e958deSchristos extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); 6292e958deSchristos extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts); 6392e958deSchristos extern inline int feraiseexcept(int __excepts); 6492e958deSchristos extern inline int fetestexcept(int __excepts); 6592e958deSchristos extern inline int fegetround(void); 6692e958deSchristos extern inline int fesetround(int __round); 6792e958deSchristos extern inline int fegetenv(fenv_t *__envp); 6892e958deSchristos extern inline int feholdexcept(fenv_t *__envp); 6992e958deSchristos extern inline int fesetenv(const fenv_t *__envp); 7092e958deSchristos extern inline int feupdateenv(const fenv_t *__envp); 71