Blame math/fenv.h

Packit 6c4009
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * ISO C99 7.6: Floating-point environment	<fenv.h>
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifndef _FENV_H
Packit 6c4009
#define _FENV_H	1
Packit 6c4009
Packit 6c4009
#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
Packit 6c4009
#include <bits/libc-header-start.h>
Packit 6c4009
Packit 6c4009
/* Get the architecture dependend definitions.  The following definitions
Packit 6c4009
   are expected to be done:
Packit 6c4009
Packit 6c4009
   fenv_t	type for object representing an entire floating-point
Packit 6c4009
		environment
Packit 6c4009
Packit 6c4009
   FE_DFL_ENV	macro of type pointer to fenv_t to be used as the argument
Packit 6c4009
		to functions taking an argument of type fenv_t; in this
Packit 6c4009
		case the default environment will be used
Packit 6c4009
Packit 6c4009
   fexcept_t	type for object representing the floating-point exception
Packit 6c4009
		flags including status associated with the flags
Packit 6c4009
Packit 6c4009
   femode_t	type for object representing floating-point control modes
Packit 6c4009
Packit 6c4009
   FE_DFL_MODE	macro of type pointer to const femode_t to be used as the
Packit 6c4009
		argument to fesetmode; in this case the default control
Packit 6c4009
		modes will be used
Packit 6c4009
Packit 6c4009
   The following macros are defined iff the implementation supports this
Packit 6c4009
   kind of exception.
Packit 6c4009
   FE_INEXACT		inexact result
Packit 6c4009
   FE_DIVBYZERO		division by zero
Packit 6c4009
   FE_UNDERFLOW		result not representable due to underflow
Packit 6c4009
   FE_OVERFLOW		result not representable due to overflow
Packit 6c4009
   FE_INVALID		invalid operation
Packit 6c4009
Packit 6c4009
   FE_ALL_EXCEPT	bitwise OR of all supported exceptions
Packit 6c4009
Packit 6c4009
   The next macros are defined iff the appropriate rounding mode is
Packit 6c4009
   supported by the implementation.
Packit 6c4009
   FE_TONEAREST		round to nearest
Packit 6c4009
   FE_UPWARD		round toward +Inf
Packit 6c4009
   FE_DOWNWARD		round toward -Inf
Packit 6c4009
   FE_TOWARDZERO	round toward 0
Packit 6c4009
*/
Packit 6c4009
#include <bits/fenv.h>
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
Packit 6c4009
/* Floating-point exception handling.  */
Packit 6c4009
Packit 6c4009
/* Clear the supported exceptions represented by EXCEPTS.  */
Packit 6c4009
extern int feclearexcept (int __excepts) __THROW;
Packit 6c4009
Packit 6c4009
/* Store implementation-defined representation of the exception flags
Packit 6c4009
   indicated by EXCEPTS in the object pointed to by FLAGP.  */
Packit 6c4009
extern int fegetexceptflag (fexcept_t *__flagp, int __excepts) __THROW;
Packit 6c4009
Packit 6c4009
/* Raise the supported exceptions represented by EXCEPTS.  */
Packit 6c4009
extern int feraiseexcept (int __excepts) __THROW;
Packit 6c4009
Packit 6c4009
#if __GLIBC_USE (IEC_60559_BFP_EXT)
Packit 6c4009
/* Set the supported exception flags represented by EXCEPTS, without
Packit 6c4009
   causing enabled traps to be taken.  */
Packit 6c4009
extern int fesetexcept (int __excepts) __THROW;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Set complete status for exceptions indicated by EXCEPTS according to
Packit 6c4009
   the representation in the object pointed to by FLAGP.  */
Packit 6c4009
extern int fesetexceptflag (const fexcept_t *__flagp, int __excepts) __THROW;
Packit 6c4009
Packit 6c4009
/* Determine which of subset of the exceptions specified by EXCEPTS are
Packit 6c4009
   currently set.  */
Packit 6c4009
extern int fetestexcept (int __excepts) __THROW;
Packit 6c4009
Packit 6c4009
#if __GLIBC_USE (IEC_60559_BFP_EXT)
Packit 6c4009
/* Determine which of subset of the exceptions specified by EXCEPTS
Packit 6c4009
   are set in *FLAGP.  */
Packit 6c4009
extern int fetestexceptflag (const fexcept_t *__flagp, int __excepts) __THROW;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Rounding control.  */
Packit 6c4009
Packit 6c4009
/* Get current rounding direction.  */
Packit 6c4009
extern int fegetround (void) __THROW __attribute_pure__;
Packit 6c4009
Packit 6c4009
/* Establish the rounding direction represented by ROUND.  */
Packit 6c4009
extern int fesetround (int __rounding_direction) __THROW;
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Floating-point environment.  */
Packit 6c4009
Packit 6c4009
/* Store the current floating-point environment in the object pointed
Packit 6c4009
   to by ENVP.  */
Packit 6c4009
extern int fegetenv (fenv_t *__envp) __THROW;
Packit 6c4009
Packit 6c4009
/* Save the current environment in the object pointed to by ENVP, clear
Packit 6c4009
   exception flags and install a non-stop mode (if available) for all
Packit 6c4009
   exceptions.  */
Packit 6c4009
extern int feholdexcept (fenv_t *__envp) __THROW;
Packit 6c4009
Packit 6c4009
/* Establish the floating-point environment represented by the object
Packit 6c4009
   pointed to by ENVP.  */
Packit 6c4009
extern int fesetenv (const fenv_t *__envp) __THROW;
Packit 6c4009
Packit 6c4009
/* Save current exceptions in temporary storage, install environment
Packit 6c4009
   represented by object pointed to by ENVP and raise exceptions
Packit 6c4009
   according to saved exceptions.  */
Packit 6c4009
extern int feupdateenv (const fenv_t *__envp) __THROW;
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Control modes.  */
Packit 6c4009
Packit 6c4009
#if __GLIBC_USE (IEC_60559_BFP_EXT)
Packit 6c4009
/* Store the current floating-point control modes in the object
Packit 6c4009
   pointed to by MODEP.  */
Packit 6c4009
extern int fegetmode (femode_t *__modep) __THROW;
Packit 6c4009
Packit 6c4009
/* Establish the floating-point control modes represented by the
Packit 6c4009
   object pointed to by MODEP.  */
Packit 6c4009
extern int fesetmode (const femode_t *__modep) __THROW;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Include optimization.  */
Packit 6c4009
#ifdef __OPTIMIZE__
Packit 6c4009
# include <bits/fenvinline.h>
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* NaN support.  */
Packit 6c4009
Packit 6c4009
#if (__GLIBC_USE (IEC_60559_BFP_EXT)		\
Packit 6c4009
     && defined FE_INVALID			\
Packit 6c4009
     && defined __SUPPORT_SNAN__)
Packit 6c4009
# define FE_SNANS_ALWAYS_SIGNAL	1
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __USE_GNU
Packit 6c4009
Packit 6c4009
/* Enable individual exceptions.  Will not enable more exceptions than
Packit 6c4009
   EXCEPTS specifies.  Returns the previous enabled exceptions if all
Packit 6c4009
   exceptions are successfully set, otherwise returns -1.  */
Packit 6c4009
extern int feenableexcept (int __excepts) __THROW;
Packit 6c4009
Packit 6c4009
/* Disable individual exceptions.  Will not disable more exceptions than
Packit 6c4009
   EXCEPTS specifies.  Returns the previous enabled exceptions if all
Packit 6c4009
   exceptions are successfully disabled, otherwise returns -1.  */
Packit 6c4009
extern int fedisableexcept (int __excepts) __THROW;
Packit 6c4009
Packit 6c4009
/* Return enabled exceptions.  */
Packit 6c4009
extern int fegetexcept (void) __THROW;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif /* fenv.h */