1*f20a32feSchristos /* $NetBSD: fenv.c,v 1.3 2019/10/26 17:57:20 christos Exp $ */ 264bdb50eSchristos 364bdb50eSchristos /*- 464bdb50eSchristos * Copyright (c) 2015 The NetBSD Foundation, Inc. 564bdb50eSchristos * All rights reserved. 664bdb50eSchristos * 764bdb50eSchristos * This code is derived from software contributed to The NetBSD Foundation 864bdb50eSchristos * by Christos Zoulas. 964bdb50eSchristos * 1064bdb50eSchristos * Redistribution and use in source and binary forms, with or without 1164bdb50eSchristos * modification, are permitted provided that the following conditions 1264bdb50eSchristos * are met: 1364bdb50eSchristos * 1. Redistributions of source code must retain the above copyright 1464bdb50eSchristos * notice, this list of conditions and the following disclaimer. 1564bdb50eSchristos * 2. Redistributions in binary form must reproduce the above copyright 1664bdb50eSchristos * notice, this list of conditions and the following disclaimer in the 1764bdb50eSchristos * documentation and/or other materials provided with the distribution. 1864bdb50eSchristos * 1964bdb50eSchristos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2064bdb50eSchristos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2164bdb50eSchristos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2264bdb50eSchristos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2364bdb50eSchristos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2464bdb50eSchristos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2564bdb50eSchristos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2664bdb50eSchristos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2764bdb50eSchristos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2864bdb50eSchristos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2964bdb50eSchristos * POSSIBILITY OF SUCH DAMAGE. 3064bdb50eSchristos */ 3164bdb50eSchristos #include <sys/cdefs.h> 32*f20a32feSchristos __RCSID("$NetBSD: fenv.c,v 1.3 2019/10/26 17:57:20 christos Exp $"); 337e30e943Schs 347e30e943Schs #include "namespace.h" 3564bdb50eSchristos 3664bdb50eSchristos #define __fenv_static 377e30e943Schs #include <fenv.h> 387e30e943Schs 397e30e943Schs #ifdef __weak_alias 407e30e943Schs __weak_alias(feclearexcept,_feclearexcept) 417e30e943Schs __weak_alias(fegetenv,_fegetenv) 427e30e943Schs __weak_alias(fegetexceptflag,_fegetexceptflag) 437e30e943Schs __weak_alias(fegetround,_fegetround) 447e30e943Schs __weak_alias(feholdexcept,_feholdexcept) 457e30e943Schs __weak_alias(feraiseexcept,_feraiseexcept) 467e30e943Schs __weak_alias(fesetenv,_fesetenv) 477e30e943Schs __weak_alias(fesetexceptflag,_fesetexceptflag) 487e30e943Schs __weak_alias(fesetround,_fesetround) 497e30e943Schs __weak_alias(fetestexcept,_fetestexcept) 507e30e943Schs __weak_alias(feupdateenv,_feupdateenv) 51*f20a32feSchristos 52*f20a32feSchristos __weak_alias(fedisableexcept,_fedisableexcept) 53*f20a32feSchristos __weak_alias(feenableexcept,_feenableexcept) 54*f20a32feSchristos __weak_alias(fegetexcept,_fegetexcept) 557e30e943Schs #endif 5664bdb50eSchristos 5764bdb50eSchristos #if defined(__GNUC_GNU_INLINE__) && !defined(__lint__) 5864bdb50eSchristos #error "This file must be compiled with C99 'inline' semantics" 5964bdb50eSchristos #endif 6064bdb50eSchristos 6164bdb50eSchristos extern inline int feclearexcept(int __excepts); 6264bdb50eSchristos extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); 6364bdb50eSchristos extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts); 6464bdb50eSchristos extern inline int feraiseexcept(int __excepts); 6564bdb50eSchristos extern inline int fetestexcept(int __excepts); 6664bdb50eSchristos extern inline int fegetround(void); 6764bdb50eSchristos extern inline int fesetround(int __round); 6864bdb50eSchristos extern inline int fegetenv(fenv_t *__envp); 6964bdb50eSchristos extern inline int feholdexcept(fenv_t *__envp); 7064bdb50eSchristos extern inline int fesetenv(const fenv_t *__envp); 7164bdb50eSchristos extern inline int feupdateenv(const fenv_t *__envp); 72*f20a32feSchristos 737e30e943Schs extern inline int feenableexcept(int __excepts); 747e30e943Schs extern inline int fedisableexcept(int __excepts); 757e30e943Schs extern inline int fegetexcept(void); 76