libroot: Make glibc use our math.h.
Only a few definitions (and some "hacks", to force glibc to use __builtin_* where possible) that are not in our math.h remain. This cuts out a lot more of the "bits" headers. No "functional" change intended (but should help fix the build on arches where we do not include __fpclassify, etc. anymore.)
This commit is contained in:
@@ -1,64 +0,0 @@
|
|||||||
/* `HUGE_VAL' constant for IEEE 754 machines (where it is infinity).
|
|
||||||
Used by <stdlib.h> and <math.h> functions for overflow.
|
|
||||||
ARM version.
|
|
||||||
Copyright (C) 1992, 95, 96, 97, 98, 99, 2000, 2004
|
|
||||||
Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, write to the Free
|
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
02111-1307 USA. */
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* IEEE positive infinity (-HUGE_VAL is negative infinity). */
|
|
||||||
|
|
||||||
#if __GNUC_PREREQ(3,3)
|
|
||||||
# define HUGE_VAL (__builtin_huge_val())
|
|
||||||
#elif __GNUC_PREREQ(2,96)
|
|
||||||
# define HUGE_VAL (__extension__ 0x1.0p2047)
|
|
||||||
#elif defined __GNUC__
|
|
||||||
|
|
||||||
# define HUGE_VAL \
|
|
||||||
(__extension__ \
|
|
||||||
((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \
|
|
||||||
{ __l: 0x000000007ff00000ULL }).__d)
|
|
||||||
|
|
||||||
#else /* not GCC */
|
|
||||||
|
|
||||||
# include <endian.h>
|
|
||||||
|
|
||||||
typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
|
|
||||||
|
|
||||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
|
||||||
# define __HUGE_VAL_bytes { 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 }
|
|
||||||
# endif
|
|
||||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
||||||
# define __HUGE_VAL_bytes { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }
|
|
||||||
# endif
|
|
||||||
|
|
||||||
static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
|
|
||||||
# define HUGE_VAL (__huge_val.__d)
|
|
||||||
|
|
||||||
#endif /* GCC. */
|
|
||||||
|
|
||||||
#if __GNUC_PREREQ(3,3)
|
|
||||||
# define HUGE_VALL (__builtin_huge_vall())
|
|
||||||
#else
|
|
||||||
# define HUGE_VALL ((long double) HUGE_VAL)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define HUGE_VALF HUGE_VAL
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/* Copyright (C) 1999, 2000, 2004, 2006, 2007
|
|
||||||
Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, write to the Free
|
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
02111-1307 USA. */
|
|
||||||
|
|
||||||
#if !defined _MATH_H && !defined _COMPLEX_H
|
|
||||||
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
|
|
||||||
# define _MATH_H_MATHDEF 1
|
|
||||||
|
|
||||||
/* GCC does not promote `float' values to `double'. */
|
|
||||||
typedef float float_t; /* `float' expressions are evaluated as
|
|
||||||
`float'. */
|
|
||||||
typedef double double_t; /* `double' expressions are evaluated as
|
|
||||||
`double'. */
|
|
||||||
|
|
||||||
/* Signal that both types are `long double'. */
|
|
||||||
# define FLT_EVAL_METHOD 2
|
|
||||||
|
|
||||||
/* Define `INFINITY' as value of type `float'. */
|
|
||||||
# define INFINITY HUGE_VALF
|
|
||||||
|
|
||||||
/* The values returned by `ilogb' for 0 and NaN respectively. */
|
|
||||||
# define FP_ILOGB0 (-2147483647)
|
|
||||||
# define FP_ILOGBNAN (2147483647)
|
|
||||||
|
|
||||||
#endif /* ISO C99 */
|
|
||||||
|
|
||||||
#ifndef __NO_LONG_DOUBLE_MATH
|
|
||||||
/* Signal that we do not really have a `long double'. This disables the
|
|
||||||
declaration of all the `long double' function variants. */
|
|
||||||
# define __NO_LONG_DOUBLE_MATH 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Number of decimal digits for the `long double' type. */
|
|
||||||
# define DECIMAL_DIG 21
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/* `NAN' constant for IEEE 754 machines.
|
|
||||||
Copyright (C) 1992, 1996, 1997, 1999 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, write to the Free
|
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
02111-1307 USA. */
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/nan.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* IEEE Not A Number. */
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
|
|
||||||
# define NAN \
|
|
||||||
(__extension__ \
|
|
||||||
((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \
|
|
||||||
{ __l: 0x7fc00000UL }).__d)
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
# include <endian.h>
|
|
||||||
|
|
||||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
|
||||||
# define __nan_bytes { 0x7f, 0xc0, 0, 0 }
|
|
||||||
# endif
|
|
||||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
||||||
# define __nan_bytes { 0, 0, 0xc0, 0x7f }
|
|
||||||
# endif
|
|
||||||
|
|
||||||
static union { unsigned char __c[4]; float __d; } __nan_union = { __nan_bytes };
|
|
||||||
# define NAN (__nan_union.__d)
|
|
||||||
|
|
||||||
#endif /* GCC. */
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/* Stub `HUGE_VAL' constant.
|
|
||||||
Used by <stdlib.h> and <math.h> functions for overflow.
|
|
||||||
Copyright (C) 1992, 1996, 1997, 2004 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# define HUGE_VAL (__builtin_huge_val())
|
|
||||||
# define HUGE_VALF (__builtin_huge_valf())
|
|
||||||
# define HUGE_VALL (__builtin_huge_vall())
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/* Copyright (C) 1999, 2000, 2004, 2006, 2007
|
|
||||||
Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, write to the Free
|
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
02111-1307 USA. */
|
|
||||||
|
|
||||||
#if !defined _MATH_H && !defined _COMPLEX_H
|
|
||||||
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
|
|
||||||
# define _MATH_H_MATHDEF 1
|
|
||||||
|
|
||||||
/* GCC does not promote `float' values to `double'. */
|
|
||||||
typedef float float_t; /* `float' expressions are evaluated as
|
|
||||||
`float'. */
|
|
||||||
typedef double double_t; /* `double' expressions are evaluated as
|
|
||||||
`double'. */
|
|
||||||
|
|
||||||
#ifdef __FLT_EVAL_METHOD__
|
|
||||||
# if __FLT_EVAL_METHOD__ == -1
|
|
||||||
# define FLT_EVAL_METHOD 2
|
|
||||||
# else
|
|
||||||
# define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# define FLT_EVAL_METHOD 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ISO C99 */
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/* `NAN' constant for IEEE 754 machines.
|
|
||||||
Copyright (C) 1992,1996,1997,1999,2004,2006 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/nan.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* IEEE Not A Number. */
|
|
||||||
# define NAN (__builtin_nanf (""))
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
/* `HUGE_VAL' constants for m68k (where it is infinity).
|
|
||||||
Used by <stdlib.h> and <math.h> functions for overflow.
|
|
||||||
Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, write to the Free
|
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
02111-1307 USA. */
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include <features.h>
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
|
|
||||||
/* IEEE positive infinity (-HUGE_VAL is negative infinity). */
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
|
|
||||||
# if __GNUC_PREREQ(2,96)
|
|
||||||
|
|
||||||
# define HUGE_VAL (__extension__ 0x1.0p2047)
|
|
||||||
|
|
||||||
# else
|
|
||||||
|
|
||||||
# define HUGE_VAL \
|
|
||||||
(__extension__ \
|
|
||||||
((union { unsigned long long __l; double __d; }) \
|
|
||||||
{ __l: 0x7ff0000000000000ULL }).__d)
|
|
||||||
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#else /* not GCC */
|
|
||||||
|
|
||||||
static union { unsigned char __c[8]; double __d; } __huge_val =
|
|
||||||
{ { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } };
|
|
||||||
# define HUGE_VAL (__huge_val.__d)
|
|
||||||
|
|
||||||
#endif /* GCC. */
|
|
||||||
|
|
||||||
|
|
||||||
/* ISO C 99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */
|
|
||||||
|
|
||||||
#ifdef __USE_ISOC99
|
|
||||||
|
|
||||||
# if __GNUC_PREREQ(2,96)
|
|
||||||
|
|
||||||
# define HUGE_VALF (__extension__ 0x1.0p255f)
|
|
||||||
# define HUGE_VALL (__extension__ 0x1.0p32767L)
|
|
||||||
|
|
||||||
# else
|
|
||||||
|
|
||||||
# ifdef __GNUC__
|
|
||||||
|
|
||||||
# define HUGE_VALF \
|
|
||||||
(__extension__ \
|
|
||||||
((union { unsigned long __l; float __f; }) \
|
|
||||||
{ __l: 0x7f800000UL }).__f)
|
|
||||||
|
|
||||||
# define HUGE_VALL \
|
|
||||||
(__extension__ \
|
|
||||||
((union { unsigned long __l[3]; long double __ld; }) \
|
|
||||||
{ __l: { 0x7fff0000UL, 0x80000000UL, 0UL } }).__ld)
|
|
||||||
|
|
||||||
# else /* not GCC */
|
|
||||||
|
|
||||||
static union { unsigned char __c[4]; float __f; } __huge_valf =
|
|
||||||
{ { 0x7f, 0x80, 0, 0 } };
|
|
||||||
# define HUGE_VALF (__huge_valf.__f)
|
|
||||||
|
|
||||||
static union { unsigned char __c[12]; long double __ld; } __huge_vall =
|
|
||||||
{ { 0x7f, 0xff, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0 } };
|
|
||||||
# define HUGE_VALL (__huge_vall.__ld)
|
|
||||||
|
|
||||||
# endif /* GCC. */
|
|
||||||
|
|
||||||
# endif /* GCC 2.95. */
|
|
||||||
|
|
||||||
#endif /* __USE_ISOC99. */
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, write to the Free
|
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
02111-1307 USA. */
|
|
||||||
|
|
||||||
#if !defined _MATH_H && !defined _COMPLEX_H
|
|
||||||
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
|
|
||||||
# define _MATH_H_MATHDEF 1
|
|
||||||
|
|
||||||
/* The m68k FPUs evaluate all values in the 96 bit floating-point format
|
|
||||||
which is also available for the user as `long double'. Therefore we
|
|
||||||
define: */
|
|
||||||
typedef long double float_t; /* `float' expressions are evaluated as
|
|
||||||
`long double'. */
|
|
||||||
typedef long double double_t; /* `double' expressions are evaluated as
|
|
||||||
`long double'. */
|
|
||||||
|
|
||||||
/* Signal that types are long double */
|
|
||||||
# define FLT_EVAL_METHOD 2
|
|
||||||
|
|
||||||
/* Define `INFINITY' as value of type `float'. */
|
|
||||||
# define INFINITY HUGE_VALF
|
|
||||||
|
|
||||||
/* The values returned by `ilogb' for 0 and NaN respectively. */
|
|
||||||
# define FP_ILOGB0 (-2147483647 - 1)
|
|
||||||
# define FP_ILOGBNAN (2147483647)
|
|
||||||
|
|
||||||
#endif /* ISO C99 */
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/* `NAN' constant for IEEE 754 machines.
|
|
||||||
Copyright (C) 1992, 1996, 1997, 1999 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, write to the Free
|
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
02111-1307 USA. */
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/nan.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* IEEE Not A Number. */
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
|
|
||||||
# define NAN \
|
|
||||||
(__extension__ \
|
|
||||||
((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \
|
|
||||||
{ __l: 0x7fc00000UL }).__d)
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
# include <endian.h>
|
|
||||||
|
|
||||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
|
||||||
# define __nan_bytes { 0x7f, 0xc0, 0, 0 }
|
|
||||||
# endif
|
|
||||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
||||||
# define __nan_bytes { 0, 0, 0xc0, 0x7f }
|
|
||||||
# endif
|
|
||||||
|
|
||||||
static union { unsigned char __c[4]; float __d; } __nan_union = { __nan_bytes };
|
|
||||||
# define NAN (__nan_union.__d)
|
|
||||||
|
|
||||||
#endif /* GCC. */
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
/* `HUGE_VAL' constants for IEEE 754 machines (where it is infinity).
|
|
||||||
Used by <stdlib.h> and <math.h> functions for overflow.
|
|
||||||
Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, write to the Free
|
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
02111-1307 USA. */
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <features.h>
|
|
||||||
|
|
||||||
/* IEEE positive infinity (-HUGE_VAL is negative infinity). */
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
|
|
||||||
# if __GNUC_PREREQ(2,96)
|
|
||||||
|
|
||||||
# define HUGE_VAL (__extension__ 0x1.0p2047)
|
|
||||||
|
|
||||||
# else
|
|
||||||
|
|
||||||
# define HUGE_VAL \
|
|
||||||
(__extension__ \
|
|
||||||
((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \
|
|
||||||
{ __l: 0x7ff0000000000000ULL }).__d)
|
|
||||||
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#else /* not GCC */
|
|
||||||
|
|
||||||
# include <endian.h>
|
|
||||||
|
|
||||||
typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
|
|
||||||
|
|
||||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
|
||||||
# define __HUGE_VAL_bytes { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
|
|
||||||
# endif
|
|
||||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
||||||
# define __HUGE_VAL_bytes { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
|
|
||||||
# endif
|
|
||||||
|
|
||||||
static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
|
|
||||||
# define HUGE_VAL (__huge_val.__d)
|
|
||||||
|
|
||||||
#endif /* GCC. */
|
|
||||||
|
|
||||||
|
|
||||||
/* ISO C99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */
|
|
||||||
|
|
||||||
#ifdef __USE_ISOC99
|
|
||||||
|
|
||||||
# ifdef __GNUC__
|
|
||||||
|
|
||||||
# if __GNUC_PREREQ(2,96)
|
|
||||||
|
|
||||||
# define HUGE_VALF (__extension__ 0x1.0p255f)
|
|
||||||
|
|
||||||
# else
|
|
||||||
|
|
||||||
# define HUGE_VALF \
|
|
||||||
(__extension__ \
|
|
||||||
((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \
|
|
||||||
{ __l: 0x7f800000UL }).__d)
|
|
||||||
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# else /* not GCC */
|
|
||||||
|
|
||||||
typedef union { unsigned char __c[4]; float __f; } __huge_valf_t;
|
|
||||||
|
|
||||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
|
||||||
# define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 }
|
|
||||||
# endif
|
|
||||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
||||||
# define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f }
|
|
||||||
# endif
|
|
||||||
|
|
||||||
static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
|
|
||||||
# define HUGE_VALF (__huge_valf.__f)
|
|
||||||
|
|
||||||
# endif /* GCC. */
|
|
||||||
|
|
||||||
|
|
||||||
/* Generally there is no separate `long double' format and it is the
|
|
||||||
same as `double'. */
|
|
||||||
# define HUGE_VALL HUGE_VAL
|
|
||||||
|
|
||||||
#endif /* __USE_ISOC99. */
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, write to the Free
|
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
02111-1307 USA. */
|
|
||||||
|
|
||||||
#if !defined _MATH_H && !defined _COMPLEX_H
|
|
||||||
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* FIXME! This file describes properties of the compiler, not the machine;
|
|
||||||
it should not be part of libc!
|
|
||||||
|
|
||||||
FIXME! This file does not deal with the -fshort-double option of
|
|
||||||
gcc! */
|
|
||||||
|
|
||||||
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
|
|
||||||
# define _MATH_H_MATHDEF 1
|
|
||||||
|
|
||||||
# ifdef __GNUC__
|
|
||||||
# if __STDC__ == 1
|
|
||||||
|
|
||||||
/* In GNU or ANSI mode, gcc leaves `float' expressions as-is. */
|
|
||||||
typedef float float_t; /* `float' expressions are evaluated as
|
|
||||||
`float'. */
|
|
||||||
typedef double double_t; /* `double' expressions are evaluated as
|
|
||||||
`double'. */
|
|
||||||
|
|
||||||
/* Signal that types stay as they were declared. */
|
|
||||||
# define FLT_EVAL_METHOD 0
|
|
||||||
|
|
||||||
/* Define `INFINITY' as value of type `float'. */
|
|
||||||
# define INFINITY HUGE_VALF
|
|
||||||
|
|
||||||
# else
|
|
||||||
|
|
||||||
/* For `gcc -traditional', `float' expressions are evaluated as `double'. */
|
|
||||||
typedef double float_t; /* `float' expressions are evaluated as
|
|
||||||
`double'. */
|
|
||||||
typedef double double_t; /* `double' expressions are evaluated as
|
|
||||||
`double'. */
|
|
||||||
|
|
||||||
/* Define `INFINITY' as value of type `float'. */
|
|
||||||
# define INFINITY HUGE_VALF
|
|
||||||
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
|
|
||||||
/* Wild guess at types for float_t and double_t. */
|
|
||||||
typedef double float_t;
|
|
||||||
typedef double double_t;
|
|
||||||
|
|
||||||
/* Define `INFINITY' as value of type `float'. */
|
|
||||||
# define INFINITY HUGE_VALF
|
|
||||||
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* The values returned by `ilogb' for 0 and NaN respectively. */
|
|
||||||
# define FP_ILOGB0 (-2147483647)
|
|
||||||
# define FP_ILOGBNAN (2147483647)
|
|
||||||
|
|
||||||
#endif /* ISO C99 */
|
|
||||||
|
|
||||||
#ifndef __NO_LONG_DOUBLE_MATH
|
|
||||||
/* Signal that we do not really have a `long double'. The disables the
|
|
||||||
declaration of all the `long double' function variants. */
|
|
||||||
# define __NO_LONG_DOUBLE_MATH 1
|
|
||||||
#endif
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/* `NAN' constant for IEEE 754 machines.
|
|
||||||
Copyright (C) 1992, 1996, 1997, 1999 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, write to the Free
|
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
02111-1307 USA. */
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/nan.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* IEEE Not A Number. */
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
|
|
||||||
# define NAN \
|
|
||||||
(__extension__ \
|
|
||||||
((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \
|
|
||||||
{ __l: 0x7fc00000UL }).__d)
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
# include <endian.h>
|
|
||||||
|
|
||||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
|
||||||
# define __nan_bytes { 0x7f, 0xc0, 0, 0 }
|
|
||||||
# endif
|
|
||||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
||||||
# define __nan_bytes { 0, 0, 0xc0, 0x7f }
|
|
||||||
# endif
|
|
||||||
|
|
||||||
static union { unsigned char __c[4]; float __d; } __nan_union = { __nan_bytes };
|
|
||||||
# define NAN (__nan_union.__d)
|
|
||||||
|
|
||||||
#endif /* GCC. */
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
# define HUGE_VAL (__builtin_huge_val())
|
|
||||||
# define HUGE_VALF (__builtin_huge_valf())
|
|
||||||
# define HUGE_VALL (__builtin_huge_vall())
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#if !defined _MATH_H && !defined _COMPLEX_H
|
|
||||||
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
|
|
||||||
# define _MATH_H_MATHDEF 1
|
|
||||||
|
|
||||||
typedef float float_t;
|
|
||||||
typedef double double_t;
|
|
||||||
|
|
||||||
/* The values returned by `ilogb' for 0 and NaN respectively. */
|
|
||||||
# define FP_ILOGB0 (-2147483647)
|
|
||||||
# define FP_ILOGBNAN (2147483647)
|
|
||||||
|
|
||||||
# define INFINITY (__builtin_inff())
|
|
||||||
|
|
||||||
/* The GCC 4.6 compiler will define __FP_FAST_FMA{,F,L} if the fma{,f,l}
|
|
||||||
builtins are supported. */
|
|
||||||
# if __FP_FAST_FMA
|
|
||||||
# define FP_FAST_FMA 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if __FP_FAST_FMAF
|
|
||||||
# define FP_FAST_FMAF 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if __FP_FAST_FMAL
|
|
||||||
# define FP_FAST_FMAL 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#endif /* ISO C99 */
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/nan.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# define NAN (__builtin_nanf (""))
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
# define HUGE_VAL (__builtin_huge_val())
|
|
||||||
# define HUGE_VALF (__builtin_huge_valf())
|
|
||||||
# define HUGE_VALL (__builtin_huge_vall())
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#if !defined _MATH_H && !defined _COMPLEX_H
|
|
||||||
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
|
|
||||||
# define _MATH_H_MATHDEF 1
|
|
||||||
|
|
||||||
typedef float float_t;
|
|
||||||
typedef double double_t;
|
|
||||||
|
|
||||||
/* The values returned by `ilogb' for 0 and NaN respectively. */
|
|
||||||
# define FP_ILOGB0 (-2147483647)
|
|
||||||
# define FP_ILOGBNAN (2147483647)
|
|
||||||
|
|
||||||
# define INFINITY (__builtin_inff())
|
|
||||||
|
|
||||||
/* The GCC 4.6 compiler will define __FP_FAST_FMA{,F,L} if the fma{,f,l}
|
|
||||||
builtins are supported. */
|
|
||||||
# if __FP_FAST_FMA
|
|
||||||
# define FP_FAST_FMA 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if __FP_FAST_FMAF
|
|
||||||
# define FP_FAST_FMAF 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if __FP_FAST_FMAL
|
|
||||||
# define FP_FAST_FMAL 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#endif /* ISO C99 */
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/nan.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# define NAN (__builtin_nanf (""))
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
/* `HUGE_VAL' constants for ix86 (where it is infinity).
|
|
||||||
Used by <stdlib.h> and <math.h> functions for overflow.
|
|
||||||
Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, write to the Free
|
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
02111-1307 USA. */
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <features.h>
|
|
||||||
|
|
||||||
/* IEEE positive infinity (-HUGE_VAL is negative infinity). */
|
|
||||||
|
|
||||||
#if __GNUC_PREREQ(2,96)
|
|
||||||
# define HUGE_VAL (__extension__ 0x1.0p2047)
|
|
||||||
#else
|
|
||||||
# define __HUGE_VAL_bytes { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
|
|
||||||
|
|
||||||
# define __huge_val_t union { unsigned char __c[8]; double __d; }
|
|
||||||
# ifdef __GNUC__
|
|
||||||
# define HUGE_VAL (__extension__ \
|
|
||||||
((__huge_val_t) { __c: __HUGE_VAL_bytes }).__d)
|
|
||||||
# else /* Not GCC. */
|
|
||||||
static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
|
|
||||||
# define HUGE_VAL (__huge_val.__d)
|
|
||||||
# endif /* GCC. */
|
|
||||||
#endif /* GCC 2.95 */
|
|
||||||
|
|
||||||
|
|
||||||
/* ISO C99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */
|
|
||||||
|
|
||||||
#ifdef __USE_ISOC99
|
|
||||||
|
|
||||||
# if __GNUC_PREREQ(2,96)
|
|
||||||
|
|
||||||
# define HUGE_VALF (__extension__ 0x1.0p255f)
|
|
||||||
# define HUGE_VALL (__extension__ 0x1.0p32767L)
|
|
||||||
|
|
||||||
# else
|
|
||||||
|
|
||||||
# define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f }
|
|
||||||
|
|
||||||
# define __huge_valf_t union { unsigned char __c[4]; float __f; }
|
|
||||||
# ifdef __GNUC__
|
|
||||||
# define HUGE_VALF (__extension__ \
|
|
||||||
((__huge_valf_t) { __c: __HUGE_VALF_bytes }).__f)
|
|
||||||
# else /* Not GCC. */
|
|
||||||
static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
|
|
||||||
# define HUGE_VALF (__huge_valf.__f)
|
|
||||||
# endif /* GCC. */
|
|
||||||
|
|
||||||
|
|
||||||
# define __HUGE_VALL_bytes { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 }
|
|
||||||
|
|
||||||
# define __huge_vall_t union { unsigned char __c[12]; long double __ld; }
|
|
||||||
# ifdef __GNUC__
|
|
||||||
# define HUGE_VALL (__extension__ \
|
|
||||||
((__huge_vall_t) { __c: __HUGE_VALL_bytes }).__ld)
|
|
||||||
# else /* Not GCC. */
|
|
||||||
static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes };
|
|
||||||
# define HUGE_VALL (__huge_vall.__ld)
|
|
||||||
# endif /* GCC. */
|
|
||||||
|
|
||||||
# endif /* GCC 2.95 */
|
|
||||||
|
|
||||||
#endif /* __USE_ISOC99. */
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2 of the
|
|
||||||
License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
|
||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
#if !defined _MATH_H && !defined _COMPLEX_H
|
|
||||||
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
|
|
||||||
# define _MATH_H_MATHDEF 1
|
|
||||||
|
|
||||||
/* The ix87 FPUs evaluate all values in the 80 bit floating-point format
|
|
||||||
which is also available for the user as `long double'. Therefore we
|
|
||||||
define: */
|
|
||||||
typedef long double float_t; /* `float' expressions are evaluated as
|
|
||||||
`long double'. */
|
|
||||||
typedef long double double_t; /* `double' expressions are evaluated as
|
|
||||||
`long double'. */
|
|
||||||
|
|
||||||
/* Signal that both types are `long double'. */
|
|
||||||
# define FLT_EVAL_METHOD 2
|
|
||||||
|
|
||||||
/* Define `INFINITY' as value of type `float'. */
|
|
||||||
# define INFINITY HUGE_VALF
|
|
||||||
|
|
||||||
/* The values returned by `ilogb' for 0 and NaN respectively. */
|
|
||||||
# define FP_ILOGB0 (-2147483647 - 1)
|
|
||||||
# define FP_ILOGBNAN (-2147483647 - 1)
|
|
||||||
|
|
||||||
/* Number of decimal digits for the `long double' type. */
|
|
||||||
# define DECIMAL_DIG 21
|
|
||||||
|
|
||||||
#endif /* ISO C99 */
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/* `NAN' constant for IEEE 754 machines.
|
|
||||||
Copyright (C) 1992, 1996, 1997, 1999 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, write to the Free
|
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
02111-1307 USA. */
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/nan.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* IEEE Not A Number. */
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
|
|
||||||
# define NAN \
|
|
||||||
(__extension__ \
|
|
||||||
((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \
|
|
||||||
{ __l: 0x7fc00000UL }).__d)
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
# include <endian.h>
|
|
||||||
|
|
||||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
|
||||||
# define __nan_bytes { 0x7f, 0xc0, 0, 0 }
|
|
||||||
# endif
|
|
||||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
||||||
# define __nan_bytes { 0, 0, 0xc0, 0x7f }
|
|
||||||
# endif
|
|
||||||
|
|
||||||
static union { unsigned char __c[4]; float __d; } __nan_union = { __nan_bytes };
|
|
||||||
# define NAN (__nan_union.__d)
|
|
||||||
|
|
||||||
#endif /* GCC. */
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
/* Stub `HUGE_VAL' constant.
|
|
||||||
Used by <stdlib.h> and <math.h> functions for overflow.
|
|
||||||
Copyright (C) 1992, 1996, 1997, 2004 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __GNUC_PREREQ(3,3)
|
|
||||||
# define HUGE_VAL (__builtin_huge_val())
|
|
||||||
#else
|
|
||||||
# define HUGE_VAL 1e37
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __GNUC_PREREQ(3,3)
|
|
||||||
# define HUGE_VALF (__builtin_huge_valf())
|
|
||||||
#else
|
|
||||||
# define HUGE_VALF 1e37f
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __GNUC_PREREQ(3,3)
|
|
||||||
# define HUGE_VALL (__builtin_huge_vall())
|
|
||||||
#else
|
|
||||||
# define HUGE_VALL ((long double) HUGE_VAL)
|
|
||||||
#endif
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
/* Copyright (C) 2001-2012 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#if !defined _MATH_H && !defined _COMPLEX_H
|
|
||||||
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
|
|
||||||
# define _MATH_H_MATHDEF 1
|
|
||||||
|
|
||||||
/* The x86-64 architecture computes values with the precission of the
|
|
||||||
used type. Similarly for -m32 -mfpmath=sse. */
|
|
||||||
typedef float float_t; /* `float' expressions are evaluated as `float'. */
|
|
||||||
typedef double double_t; /* `double' expressions are evaluated
|
|
||||||
as `double'. */
|
|
||||||
|
|
||||||
#define FLT_EVAL_METHOD 0
|
|
||||||
|
|
||||||
#if __GNUC_PREREQ(3,3)
|
|
||||||
# define INFINITY (__builtin_inff())
|
|
||||||
#else
|
|
||||||
# define INFINITY HUGE_VALF
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The values returned by `ilogb' for 0 and NaN respectively. */
|
|
||||||
# define FP_ILOGB0 (-2147483647 - 1)
|
|
||||||
# define FP_ILOGBNAN (-2147483647 - 1)
|
|
||||||
|
|
||||||
/* The GCC 4.6 compiler will define __FP_FAST_FMA{,F,L} if the fma{,f,l}
|
|
||||||
builtins are supported. */
|
|
||||||
# if __FP_FAST_FMA
|
|
||||||
# define FP_FAST_FMA 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if __FP_FAST_FMAF
|
|
||||||
# define FP_FAST_FMAF 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if __FP_FAST_FMAL
|
|
||||||
# define FP_FAST_FMAL 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#endif /* ISO C99 */
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/* `NAN' constant for IEEE 754 machines.
|
|
||||||
Copyright (C) 1992,1996,1997,1999,2004,2006 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
|
||||||
# error "Never use <bits/nan.h> directly; include <math.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* IEEE Not A Number. */
|
|
||||||
|
|
||||||
#if __GNUC_PREREQ(3,3)
|
|
||||||
|
|
||||||
# define NAN (__builtin_nanf (""))
|
|
||||||
|
|
||||||
#elif defined __GNUC__
|
|
||||||
|
|
||||||
# define NAN \
|
|
||||||
(__extension__ \
|
|
||||||
((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; }) \
|
|
||||||
{ __l: 0x7fc00000UL }).__d)
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
# include <endian.h>
|
|
||||||
|
|
||||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
|
||||||
# define __nan_bytes { 0x7f, 0xc0, 0, 0 }
|
|
||||||
# endif
|
|
||||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
||||||
# define __nan_bytes { 0, 0, 0xc0, 0x7f }
|
|
||||||
# endif
|
|
||||||
|
|
||||||
static union { unsigned char __c[4]; float __d; } __nan_union
|
|
||||||
__attribute_used__ = { __nan_bytes };
|
|
||||||
# define NAN (__nan_union.__d)
|
|
||||||
|
|
||||||
#endif /* GCC. */
|
|
||||||
@@ -25,11 +25,17 @@
|
|||||||
|
|
||||||
#include <features.h>
|
#include <features.h>
|
||||||
|
|
||||||
/* Get general and ISO C99 specific information. */
|
|
||||||
#include <bits/mathdef.h>
|
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#if __GNUC__ >= 7
|
||||||
|
#define __isinfl(value) __builtin_isinfl(value)
|
||||||
|
#define __isnan(value) __builtin_isnan(value)
|
||||||
|
#define __isnanf(value) __builtin_isnanf(value)
|
||||||
|
#define __isnanl(value) __builtin_isnanl(value)
|
||||||
|
#define __isinf(value) __builtin_isinf(value)
|
||||||
|
#define __isinff(value) __builtin_isinff(value)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* We might need to add support for more compilers here. But since ISO
|
/* We might need to add support for more compilers here. But since ISO
|
||||||
C99 is out hopefully all maintained compilers will soon provide the data
|
C99 is out hopefully all maintained compilers will soon provide the data
|
||||||
types `float complex' and `double complex'. */
|
types `float complex' and `double complex'. */
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
/* Declarations for math functions.
|
/* The GNU C Library is free software; you can redistribute it and/or
|
||||||
Copyright (C) 1991-1993,1995-1999,2001,2002 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
@@ -17,407 +13,24 @@
|
|||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
02111-1307 USA. */
|
02111-1307 USA. */
|
||||||
|
|
||||||
/*
|
|
||||||
* ISO C99 Standard: 7.12 Mathematics <math.h>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
#ifndef _MATH_H
|
||||||
#define _MATH_H 1
|
#define _MATH_H 1
|
||||||
|
|
||||||
|
#include_next <math.h>
|
||||||
|
|
||||||
#include <features.h>
|
#include <features.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
#if __GNUC__ == 2
|
||||||
|
#define __HUGE_VALL_bytes { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 }
|
||||||
|
|
||||||
/* Get machine-dependent HUGE_VAL value (returned on overflow).
|
#define __huge_vall_t union { unsigned char __c[12]; long double __ld; }
|
||||||
On all IEEE754 machines, this is +Infinity. */
|
#define HUGE_VALL (__extension__ \
|
||||||
#include <bits/huge_val.h>
|
((__huge_vall_t) { __c: __HUGE_VALL_bytes }).__ld)
|
||||||
|
|
||||||
/* Get machine-dependent NAN value (returned for some domain errors). */
|
|
||||||
#ifdef __USE_ISOC99
|
|
||||||
# include <bits/nan.h>
|
|
||||||
#endif
|
|
||||||
/* Get general and ISO C99 specific information. */
|
|
||||||
#include <bits/mathdef.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* The file <bits/mathcalls.h> contains the prototypes for all the
|
|
||||||
actual math functions. These macros are used for those prototypes,
|
|
||||||
so we can easily declare each function as both `name' and `__name',
|
|
||||||
and can declare the float versions `namef' and `__namef'. */
|
|
||||||
|
|
||||||
#define __MATHCALL(function,suffix, args) \
|
|
||||||
__MATHDECL (_Mdouble_,function,suffix, args)
|
|
||||||
#define __MATHDECL(type, function,suffix, args) \
|
|
||||||
__MATHDECL_1(type, function,suffix, args); \
|
|
||||||
__MATHDECL_1(type, __CONCAT(__,function),suffix, args)
|
|
||||||
#define __MATHCALLX(function,suffix, args, attrib) \
|
|
||||||
__MATHDECLX (_Mdouble_,function,suffix, args, attrib)
|
|
||||||
#define __MATHDECLX(type, function,suffix, args, attrib) \
|
|
||||||
__MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); \
|
|
||||||
__MATHDECL_1(type, __CONCAT(__,function),suffix, args) __attribute__ (attrib)
|
|
||||||
#define __MATHDECL_1(type, function,suffix, args) \
|
|
||||||
extern type __MATH_PRECNAME(function,suffix) args __THROW
|
|
||||||
|
|
||||||
#define _Mdouble_ double
|
|
||||||
#define __MATH_PRECNAME(name,r) __CONCAT(name,r)
|
|
||||||
# define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD
|
|
||||||
# define _Mdouble_END_NAMESPACE __END_NAMESPACE_STD
|
|
||||||
#include <bits/mathcalls.h>
|
|
||||||
#undef _Mdouble_
|
|
||||||
#undef _Mdouble_BEGIN_NAMESPACE
|
|
||||||
#undef _Mdouble_END_NAMESPACE
|
|
||||||
#undef __MATH_PRECNAME
|
|
||||||
|
|
||||||
#if defined __USE_MISC || defined __USE_ISOC99
|
|
||||||
|
|
||||||
|
|
||||||
/* Include the file of declarations again, this time using `float'
|
|
||||||
instead of `double' and appending f to each function name. */
|
|
||||||
|
|
||||||
# ifndef _Mfloat_
|
|
||||||
# define _Mfloat_ float
|
|
||||||
# endif
|
|
||||||
# define _Mdouble_ _Mfloat_
|
|
||||||
# ifdef __STDC__
|
|
||||||
# define __MATH_PRECNAME(name,r) name##f##r
|
|
||||||
# else
|
|
||||||
# define __MATH_PRECNAME(name,r) name/**/f/**/r
|
|
||||||
# endif
|
|
||||||
# define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99
|
|
||||||
# define _Mdouble_END_NAMESPACE __END_NAMESPACE_C99
|
|
||||||
# include <bits/mathcalls.h>
|
|
||||||
# undef _Mdouble_
|
|
||||||
# undef _Mdouble_BEGIN_NAMESPACE
|
|
||||||
# undef _Mdouble_END_NAMESPACE
|
|
||||||
# undef __MATH_PRECNAME
|
|
||||||
|
|
||||||
# if (__STDC__ - 0 || __GNUC__ - 0) && !defined __NO_LONG_DOUBLE_MATH
|
|
||||||
/* Include the file of declarations again, this time using `long double'
|
|
||||||
instead of `double' and appending l to each function name. */
|
|
||||||
|
|
||||||
# ifndef _Mlong_double_
|
|
||||||
# define _Mlong_double_ long double
|
|
||||||
# endif
|
|
||||||
# define _Mdouble_ _Mlong_double_
|
|
||||||
# ifdef __STDC__
|
|
||||||
# define __MATH_PRECNAME(name,r) name##l##r
|
|
||||||
# else
|
|
||||||
# define __MATH_PRECNAME(name,r) name/**/l/**/r
|
|
||||||
# endif
|
|
||||||
# define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99
|
|
||||||
# define _Mdouble_END_NAMESPACE __END_NAMESPACE_C99
|
|
||||||
# include <bits/mathcalls.h>
|
|
||||||
# undef _Mdouble_
|
|
||||||
# undef _Mdouble_BEGIN_NAMESPACE
|
|
||||||
# undef _Mdouble_END_NAMESPACE
|
|
||||||
# undef __MATH_PRECNAME
|
|
||||||
|
|
||||||
# endif /* __STDC__ || __GNUC__ */
|
|
||||||
|
|
||||||
#endif /* Use misc or ISO C99. */
|
|
||||||
#undef __MATHDECL_1
|
|
||||||
#undef __MATHDECL
|
|
||||||
#undef __MATHCALL
|
|
||||||
|
|
||||||
|
|
||||||
#if defined __USE_MISC || defined __USE_XOPEN
|
|
||||||
/* This variable is used by `gamma' and `lgamma'. */
|
|
||||||
extern int signgam;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Depending on the type of TG_ARG, call an appropriately suffixed
|
|
||||||
version of FUNC with arguments (including parentheses) ARGS.
|
|
||||||
Suffixed functions may not exist for long double if it has the same
|
|
||||||
format as double, or for other types with the same format as float,
|
|
||||||
double or long double. The behavior is undefined if the argument
|
|
||||||
does not have a real floating type. The definition may use a
|
|
||||||
conditional expression, so all suffixed versions of FUNC must
|
|
||||||
return the same type (FUNC may include a cast if necessary rather
|
|
||||||
than being a single identifier). */
|
|
||||||
#ifdef __NO_LONG_DOUBLE_MATH
|
|
||||||
# if __HAVE_DISTINCT_FLOAT128
|
|
||||||
# error "Distinct _Float128 without distinct long double not supported."
|
|
||||||
# endif
|
|
||||||
# define __MATH_TG(TG_ARG, FUNC, ARGS) \
|
|
||||||
(sizeof (TG_ARG) == sizeof (float) ? FUNC ## f ARGS : FUNC ARGS)
|
|
||||||
#elif __HAVE_DISTINCT_FLOAT128
|
|
||||||
# if __HAVE_GENERIC_SELECTION
|
|
||||||
# if __HAVE_FLOATN_NOT_TYPEDEF && __HAVE_FLOAT32
|
|
||||||
# define __MATH_TG_F32(FUNC, ARGS) _Float32: FUNC ## f ARGS,
|
|
||||||
# else
|
|
||||||
# define __MATH_TG_F32(FUNC, ARGS)
|
|
||||||
# endif
|
|
||||||
# if __HAVE_FLOATN_NOT_TYPEDEF && __HAVE_FLOAT64X
|
|
||||||
# if __HAVE_FLOAT64X_LONG_DOUBLE
|
|
||||||
# define __MATH_TG_F64X(FUNC, ARGS) _Float64x: FUNC ## l ARGS,
|
|
||||||
# else
|
|
||||||
# define __MATH_TG_F64X(FUNC, ARGS) _Float64x: FUNC ## f128 ARGS,
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# define __MATH_TG_F64X(FUNC, ARGS)
|
|
||||||
# endif
|
|
||||||
# define __MATH_TG(TG_ARG, FUNC, ARGS) \
|
|
||||||
_Generic ((TG_ARG), \
|
|
||||||
float: FUNC ## f ARGS, \
|
|
||||||
__MATH_TG_F32 (FUNC, ARGS) \
|
|
||||||
default: FUNC ARGS, \
|
|
||||||
long double: FUNC ## l ARGS, \
|
|
||||||
__MATH_TG_F64X (FUNC, ARGS) \
|
|
||||||
_Float128: FUNC ## f128 ARGS)
|
|
||||||
# else
|
|
||||||
# if __HAVE_FLOATN_NOT_TYPEDEF
|
|
||||||
# error "Non-typedef _FloatN but no _Generic."
|
|
||||||
# endif
|
|
||||||
# define __MATH_TG(TG_ARG, FUNC, ARGS) \
|
|
||||||
__builtin_choose_expr \
|
|
||||||
(__builtin_types_compatible_p (__typeof (TG_ARG), float), \
|
|
||||||
FUNC ## f ARGS, \
|
|
||||||
__builtin_choose_expr \
|
|
||||||
(__builtin_types_compatible_p (__typeof (TG_ARG), double), \
|
|
||||||
FUNC ARGS, \
|
|
||||||
__builtin_choose_expr \
|
|
||||||
(__builtin_types_compatible_p (__typeof (TG_ARG), long double), \
|
|
||||||
FUNC ## l ARGS, \
|
|
||||||
FUNC ## f128 ARGS)))
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# define __MATH_TG(TG_ARG, FUNC, ARGS) \
|
|
||||||
(sizeof (TG_ARG) == sizeof (float) \
|
|
||||||
? FUNC ## f ARGS \
|
|
||||||
: sizeof (TG_ARG) == sizeof (double) \
|
|
||||||
? FUNC ARGS \
|
|
||||||
: FUNC ## l ARGS)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* ISO C99 defines some generic macros which work on any data type. */
|
|
||||||
#if __USE_ISOC99
|
|
||||||
|
|
||||||
/* Get the architecture specific values describing the floating-point
|
|
||||||
evaluation. The following symbols will get defined:
|
|
||||||
|
|
||||||
float_t floating-point type at least as wide as `float' used
|
|
||||||
to evaluate `float' expressions
|
|
||||||
double_t floating-point type at least as wide as `double' used
|
|
||||||
to evaluate `double' expressions
|
|
||||||
|
|
||||||
FLT_EVAL_METHOD
|
|
||||||
Defined to
|
|
||||||
0 if `float_t' is `float' and `double_t' is `double'
|
|
||||||
1 if `float_t' and `double_t' are `double'
|
|
||||||
2 if `float_t' and `double_t' are `long double'
|
|
||||||
else `float_t' and `double_t' are unspecified
|
|
||||||
|
|
||||||
INFINITY representation of the infinity value of type `float'
|
|
||||||
|
|
||||||
FP_FAST_FMA
|
|
||||||
FP_FAST_FMAF
|
|
||||||
FP_FAST_FMAL
|
|
||||||
If defined it indicates that the `fma' function
|
|
||||||
generally executes about as fast as a multiply and an add.
|
|
||||||
This macro is defined only iff the `fma' function is
|
|
||||||
implemented directly with a hardware multiply-add instructions.
|
|
||||||
|
|
||||||
FP_ILOGB0 Expands to a value returned by `ilogb (0.0)'.
|
|
||||||
FP_ILOGBNAN Expands to a value returned by `ilogb (NAN)'.
|
|
||||||
|
|
||||||
DECIMAL_DIG Number of decimal digits supported by conversion between
|
|
||||||
decimal and all internal floating-point formats.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* All floating-point numbers can be put in one of these categories. */
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
FP_NAN,
|
|
||||||
# define FP_NAN FP_NAN
|
|
||||||
FP_INFINITE,
|
|
||||||
# define FP_INFINITE FP_INFINITE
|
|
||||||
FP_ZERO,
|
|
||||||
# define FP_ZERO FP_ZERO
|
|
||||||
FP_SUBNORMAL,
|
|
||||||
# define FP_SUBNORMAL FP_SUBNORMAL
|
|
||||||
FP_NORMAL
|
|
||||||
# define FP_NORMAL FP_NORMAL
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Return number of classification appropriate for X. */
|
|
||||||
# ifdef __NO_LONG_DOUBLE_MATH
|
|
||||||
# define fpclassify(x) \
|
|
||||||
(sizeof (x) == sizeof (float) ? __fpclassifyf (x) : __fpclassify (x))
|
|
||||||
# else
|
|
||||||
# define fpclassify(x) \
|
|
||||||
(sizeof (x) == sizeof (float) \
|
|
||||||
? __fpclassifyf (x) \
|
|
||||||
: sizeof (x) == sizeof (double) \
|
|
||||||
? __fpclassify (x) : __fpclassifyl (x))
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Return nonzero value if sign of X is negative. */
|
|
||||||
# ifdef __NO_LONG_DOUBLE_MATH
|
|
||||||
# define signbit(x) \
|
|
||||||
(sizeof (x) == sizeof (float) ? __signbitf (x) : __signbit (x))
|
|
||||||
# else
|
|
||||||
# define signbit(x) \
|
|
||||||
(sizeof (x) == sizeof (float) \
|
|
||||||
? __signbitf (x) \
|
|
||||||
: sizeof (x) == sizeof (double) \
|
|
||||||
? __signbit (x) : __signbitl (x))
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Return nonzero value if X is not +-Inf or NaN. */
|
|
||||||
# ifdef __NO_LONG_DOUBLE_MATH
|
|
||||||
# define isfinite(x) \
|
|
||||||
(sizeof (x) == sizeof (float) ? __finitef (x) : __finite (x))
|
|
||||||
# else
|
|
||||||
# define isfinite(x) \
|
|
||||||
(sizeof (x) == sizeof (float) \
|
|
||||||
? __finitef (x) \
|
|
||||||
: sizeof (x) == sizeof (double) \
|
|
||||||
? __finite (x) : __finitel (x))
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Return nonzero value if X is neither zero, subnormal, Inf, nor NaN. */
|
|
||||||
# define isnormal(x) (fpclassify (x) == FP_NORMAL)
|
|
||||||
|
|
||||||
/* Return nonzero value if X is a NaN. We could use `fpclassify' but
|
|
||||||
we already have this functions `__isnan' and it is faster. */
|
|
||||||
# ifdef __NO_LONG_DOUBLE_MATH
|
|
||||||
# define isnan(x) \
|
|
||||||
(sizeof (x) == sizeof (float) ? __isnanf (x) : __isnan (x))
|
|
||||||
# else
|
|
||||||
# define isnan(x) \
|
|
||||||
(sizeof (x) == sizeof (float) \
|
|
||||||
? __isnanf (x) \
|
|
||||||
: sizeof (x) == sizeof (double) \
|
|
||||||
? __isnan (x) : __isnanl (x))
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Return nonzero value is X is positive or negative infinity. */
|
|
||||||
# ifdef __NO_LONG_DOUBLE_MATH
|
|
||||||
# define isinf(x) \
|
|
||||||
(sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x))
|
|
||||||
# else
|
|
||||||
# define isinf(x) \
|
|
||||||
(sizeof (x) == sizeof (float) \
|
|
||||||
? __isinff (x) \
|
|
||||||
: sizeof (x) == sizeof (double) \
|
|
||||||
? __isinf (x) : __isinfl (x))
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Bitmasks for the math_errhandling macro. */
|
|
||||||
# define MATH_ERRNO 1 /* errno set by math functions. */
|
|
||||||
# define MATH_ERREXCEPT 2 /* Exceptions raised by math functions. */
|
|
||||||
|
|
||||||
#endif /* Use ISO C99. */
|
|
||||||
|
|
||||||
/* Return nonzero value if X is a signaling NaN. */
|
|
||||||
# ifndef __cplusplus
|
|
||||||
# define issignaling(x) __MATH_TG ((x), __issignaling, (x))
|
|
||||||
# else
|
|
||||||
/* In C++ mode, __MATH_TG cannot be used, because it relies on
|
|
||||||
__builtin_types_compatible_p, which is a C-only builtin. */
|
|
||||||
# ifdef __NO_LONG_DOUBLE_MATH
|
|
||||||
# define issignaling(x) \
|
|
||||||
(sizeof (x) == sizeof (float) ? __issignalingf (x) : __issignaling (x))
|
|
||||||
# else
|
|
||||||
# define issignaling(x) \
|
|
||||||
(sizeof (x) == sizeof (float) \
|
|
||||||
? __issignalingf (x) \
|
|
||||||
: sizeof (x) == sizeof (double) \
|
|
||||||
? __issignaling (x) : __issignalingl (x))
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __USE_MISC
|
|
||||||
/* Support for various different standard error handling behaviors. */
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
_IEEE_ = -1, /* According to IEEE 754/IEEE 854. */
|
|
||||||
_SVID_, /* According to System V, release 4. */
|
|
||||||
_XOPEN_, /* Nowadays also Unix98. */
|
|
||||||
_POSIX_,
|
|
||||||
_ISOC_ /* Actually this is ISO C99. */
|
|
||||||
} _LIB_VERSION_TYPE;
|
|
||||||
|
|
||||||
/* This variable can be changed at run-time to any of the values above to
|
|
||||||
affect floating point error handling behavior (it may also be necessary
|
|
||||||
to change the hardware FPU exception settings). */
|
|
||||||
extern _LIB_VERSION_TYPE _LIB_VERSION;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __USE_SVID
|
|
||||||
/* In SVID error handling, `matherr' is called with this description
|
|
||||||
of the exceptional condition.
|
|
||||||
|
|
||||||
We have a problem when using C++ since `exception' is a reserved
|
|
||||||
name in C++. */
|
|
||||||
# ifdef __cplusplus
|
|
||||||
struct __exception
|
|
||||||
# else
|
|
||||||
struct exception
|
|
||||||
# endif
|
|
||||||
{
|
|
||||||
int type;
|
|
||||||
char *name;
|
|
||||||
double arg1;
|
|
||||||
double arg2;
|
|
||||||
double retval;
|
|
||||||
};
|
|
||||||
|
|
||||||
# ifdef __cplusplus
|
|
||||||
extern int matherr (struct __exception *__exc) throw ();
|
|
||||||
# else
|
|
||||||
extern int matherr (struct exception *__exc);
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# define X_TLOSS 1.41484755040568800000e+16
|
|
||||||
|
|
||||||
/* Types of exceptions in the `type' field. */
|
|
||||||
# define DOMAIN 1
|
|
||||||
# define SING 2
|
|
||||||
# define OVERFLOW 3
|
|
||||||
# define UNDERFLOW 4
|
|
||||||
# define TLOSS 5
|
|
||||||
# define PLOSS 6
|
|
||||||
|
|
||||||
/* SVID mode specifies returning this large value instead of infinity. */
|
|
||||||
# define HUGE 3.40282347e+38F
|
|
||||||
|
|
||||||
#else /* !SVID */
|
|
||||||
|
|
||||||
# ifdef __USE_XOPEN
|
|
||||||
/* X/Open wants another strange constant. */
|
|
||||||
# define MAXFLOAT 3.40282347e+38F
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#endif /* SVID */
|
|
||||||
|
|
||||||
|
|
||||||
/* Some useful constants. */
|
|
||||||
#if defined __USE_BSD || defined __USE_XOPEN
|
|
||||||
# define M_E 2.7182818284590452354 /* e */
|
|
||||||
# define M_LOG2E 1.4426950408889634074 /* log_2 e */
|
|
||||||
# define M_LOG10E 0.43429448190325182765 /* log_10 e */
|
|
||||||
# define M_LN2 0.69314718055994530942 /* log_e 2 */
|
|
||||||
# define M_LN10 2.30258509299404568402 /* log_e 10 */
|
|
||||||
# define M_PI 3.14159265358979323846 /* pi */
|
|
||||||
# define M_PI_2 1.57079632679489661923 /* pi/2 */
|
|
||||||
# define M_PI_4 0.78539816339744830962 /* pi/4 */
|
|
||||||
# define M_1_PI 0.31830988618379067154 /* 1/pi */
|
|
||||||
# define M_2_PI 0.63661977236758134308 /* 2/pi */
|
|
||||||
# define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
|
|
||||||
# define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
|
|
||||||
# define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The above constants are not adequate for computation using `long double's.
|
/* The above constants are not adequate for computation using `long double's.
|
||||||
Therefore we provide as an extension constants with similar names as a
|
Therefore we provide as an extension constants with similar names as a
|
||||||
GNU extension. Provide enough digits for the 128-bit IEEE quad. */
|
GNU extension. Provide enough digits for the 128-bit IEEE quad. */
|
||||||
#ifdef __USE_GNU
|
|
||||||
# define M_El 2.7182818284590452353602874713526625L /* e */
|
# define M_El 2.7182818284590452353602874713526625L /* e */
|
||||||
# define M_LOG2El 1.4426950408889634073599246810018921L /* log_2 e */
|
# define M_LOG2El 1.4426950408889634073599246810018921L /* log_2 e */
|
||||||
# define M_LOG10El 0.4342944819032518276511289189166051L /* log_10 e */
|
# define M_LOG10El 0.4342944819032518276511289189166051L /* log_10 e */
|
||||||
@@ -431,74 +44,9 @@ extern int matherr (struct exception *__exc);
|
|||||||
# define M_2_SQRTPIl 1.1283791670955125738961589031215452L /* 2/sqrt(pi) */
|
# define M_2_SQRTPIl 1.1283791670955125738961589031215452L /* 2/sqrt(pi) */
|
||||||
# define M_SQRT2l 1.4142135623730950488016887242096981L /* sqrt(2) */
|
# define M_SQRT2l 1.4142135623730950488016887242096981L /* sqrt(2) */
|
||||||
# define M_SQRT1_2l 0.7071067811865475244008443621048490L /* 1/sqrt(2) */
|
# define M_SQRT1_2l 0.7071067811865475244008443621048490L /* 1/sqrt(2) */
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* When compiling in strict ISO C compatible mode we must not use the
|
|
||||||
inline functions since they, among other things, do not set the
|
|
||||||
`errno' variable correctly. */
|
|
||||||
#if defined __STRICT_ANSI__ && !defined __NO_MATH_INLINES
|
|
||||||
# define __NO_MATH_INLINES 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __USE_ISOC99
|
|
||||||
/* ISO C99 defines some macros to compare number while taking care
|
|
||||||
for unordered numbers. Since many FPUs provide special
|
|
||||||
instructions to support these operations and these tests are
|
|
||||||
defined in <bits/mathinline.h>, we define the generic macros at
|
|
||||||
this late point and only if they are not defined yet. */
|
|
||||||
|
|
||||||
/* Return nonzero value if X is greater than Y. */
|
|
||||||
# ifndef isgreater
|
|
||||||
# define isgreater(x, y) \
|
|
||||||
(__extension__ \
|
|
||||||
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
|
||||||
!isunordered (__x, __y) && __x > __y; }))
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Return nonzero value if X is greater than or equal to Y. */
|
|
||||||
# ifndef isgreaterequal
|
|
||||||
# define isgreaterequal(x, y) \
|
|
||||||
(__extension__ \
|
|
||||||
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
|
||||||
!isunordered (__x, __y) && __x >= __y; }))
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Return nonzero value if X is less than Y. */
|
|
||||||
# ifndef isless
|
|
||||||
# define isless(x, y) \
|
|
||||||
(__extension__ \
|
|
||||||
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
|
||||||
!isunordered (__x, __y) && __x < __y; }))
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Return nonzero value if X is less than or equal to Y. */
|
|
||||||
# ifndef islessequal
|
|
||||||
# define islessequal(x, y) \
|
|
||||||
(__extension__ \
|
|
||||||
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
|
||||||
!isunordered (__x, __y) && __x <= __y; }))
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Return nonzero value if either X is less than Y or Y is less than X. */
|
|
||||||
# ifndef islessgreater
|
|
||||||
# define islessgreater(x, y) \
|
|
||||||
(__extension__ \
|
|
||||||
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
|
||||||
!isunordered (__x, __y) && (__x < __y || __y < __x); }))
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Return nonzero value if arguments are unordered. */
|
|
||||||
# ifndef isunordered
|
|
||||||
# define isunordered(u, v) \
|
|
||||||
(__extension__ \
|
|
||||||
({ __typeof__(u) __u = (u); __typeof__(v) __v = (v); \
|
|
||||||
fpclassify (__u) == FP_NAN || fpclassify (__v) == FP_NAN; }))
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__END_DECLS
|
|
||||||
|
|
||||||
|
extern void sincos(double x, double *sin, double *cos);
|
||||||
|
extern void sincosf(float x, float *sin, float *cos);
|
||||||
|
extern void sincosl(long double x, long double *sin, long double *cos);
|
||||||
|
|
||||||
#endif /* math.h */
|
#endif /* math.h */
|
||||||
|
|||||||
Reference in New Issue
Block a user