1*7e30e943Schs /* $NetBSD: fenv.c,v 1.3 2017/03/22 23:11:08 chs Exp $ */ 263aea4bdSchristos 363aea4bdSchristos /*- 463aea4bdSchristos * Copyright (c) 2004 David Schultz <das@FreeBSD.ORG> 563aea4bdSchristos * All rights reserved. 663aea4bdSchristos * 763aea4bdSchristos * Redistribution and use in source and binary forms, with or without 863aea4bdSchristos * modification, are permitted provided that the following conditions 963aea4bdSchristos * are met: 1063aea4bdSchristos * 1. Redistributions of source code must retain the above copyright 1163aea4bdSchristos * notice, this list of conditions and the following disclaimer. 1263aea4bdSchristos * 2. Redistributions in binary form must reproduce the above copyright 1363aea4bdSchristos * notice, this list of conditions and the following disclaimer in the 1463aea4bdSchristos * documentation and/or other materials provided with the distribution. 1563aea4bdSchristos * 1663aea4bdSchristos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1763aea4bdSchristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1863aea4bdSchristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1963aea4bdSchristos * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2063aea4bdSchristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2163aea4bdSchristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2263aea4bdSchristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2363aea4bdSchristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2463aea4bdSchristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2563aea4bdSchristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2663aea4bdSchristos * SUCH DAMAGE. 2763aea4bdSchristos * 2863aea4bdSchristos * $FreeBSD: head/lib/msun/mips/fenv.c 226415 2011-10-16 05:37:56Z das $ 2963aea4bdSchristos */ 3063aea4bdSchristos #include <sys/cdefs.h> 31*7e30e943Schs __RCSID("$NetBSD: fenv.c,v 1.3 2017/03/22 23:11:08 chs Exp $"); 32*7e30e943Schs 33*7e30e943Schs #include "namespace.h" 3463aea4bdSchristos 3563aea4bdSchristos #define __fenv_static 36*7e30e943Schs #include <fenv.h> 37*7e30e943Schs 38*7e30e943Schs #ifdef __weak_alias 39*7e30e943Schs __weak_alias(feclearexcept,_feclearexcept) 40*7e30e943Schs __weak_alias(fedisableexcept,_fedisableexcept) 41*7e30e943Schs __weak_alias(feenableexcept,_feenableexcept) 42*7e30e943Schs __weak_alias(fegetenv,_fegetenv) 43*7e30e943Schs __weak_alias(fegetexcept,_fegetexcept) 44*7e30e943Schs __weak_alias(fegetexceptflag,_fegetexceptflag) 45*7e30e943Schs __weak_alias(fegetround,_fegetround) 46*7e30e943Schs __weak_alias(feholdexcept,_feholdexcept) 47*7e30e943Schs __weak_alias(feraiseexcept,_feraiseexcept) 48*7e30e943Schs __weak_alias(fesetenv,_fesetenv) 49*7e30e943Schs __weak_alias(fesetexceptflag,_fesetexceptflag) 50*7e30e943Schs __weak_alias(fesetround,_fesetround) 51*7e30e943Schs __weak_alias(fetestexcept,_fetestexcept) 52*7e30e943Schs __weak_alias(feupdateenv,_feupdateenv) 53*7e30e943Schs #endif 5463aea4bdSchristos 55caa46aefSchristos #if defined(__GNUC_GNU_INLINE__) && !defined(__lint__) 5663aea4bdSchristos #error "This file must be compiled with C99 'inline' semantics" 5763aea4bdSchristos #endif 5863aea4bdSchristos 5963aea4bdSchristos /* 6063aea4bdSchristos * Hopefully the system ID byte is immutable, so it's valid to use 6163aea4bdSchristos * this as a default environment. 6263aea4bdSchristos */ 6363aea4bdSchristos const fenv_t __fe_dfl_env = 0; 6463aea4bdSchristos 6563aea4bdSchristos extern inline int feclearexcept(int __excepts); 6663aea4bdSchristos extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); 6763aea4bdSchristos extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts); 6863aea4bdSchristos extern inline int feraiseexcept(int __excepts); 6963aea4bdSchristos extern inline int fetestexcept(int __excepts); 7063aea4bdSchristos extern inline int fegetround(void); 7163aea4bdSchristos extern inline int fesetround(int __round); 7263aea4bdSchristos extern inline int fegetenv(fenv_t *__envp); 7363aea4bdSchristos extern inline int feholdexcept(fenv_t *__envp); 7463aea4bdSchristos extern inline int fesetenv(const fenv_t *__envp); 7563aea4bdSchristos extern inline int feupdateenv(const fenv_t *__envp); 76*7e30e943Schs extern inline int feenableexcept(int __excepts); 77*7e30e943Schs extern inline int fedisableexcept(int __excepts); 78*7e30e943Schs extern inline int fegetexcept(void); 79