2016-06-14 16:44:14 +00:00
|
|
|
/* Helper macros for type generic function implementations within libm.
|
2019-01-01 00:11:28 +00:00
|
|
|
Copyright (C) 2016-2019 Free Software Foundation, Inc.
|
2016-06-14 16:44:14 +00:00
|
|
|
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
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
2016-06-14 16:44:14 +00:00
|
|
|
|
|
|
|
#ifndef _MATH_TYPE_MACROS
|
|
|
|
#define _MATH_TYPE_MACROS
|
|
|
|
|
|
|
|
/* Each type imports a header which is expected to
|
|
|
|
define:
|
|
|
|
|
|
|
|
M_LIT(x) - Paste the type specific suffix onto the constant x.
|
|
|
|
M_MLIT(x) - Paste the type specific suffix used by the macro
|
|
|
|
constants in math.h, i.e M_PI or M_PIl.
|
|
|
|
M_PFX - The prefixed used by float.h macros like FLT_MANT_DIG.
|
|
|
|
M_SUF(x) - Paste the the type specific suffix used by functions
|
|
|
|
i.e expf expl exp.
|
|
|
|
FLOAT - Resolves to the C typename of M_TYPE.
|
|
|
|
CFLOAT - Resolves to the complex typename of M_TYPE.
|
2016-09-12 22:32:07 +00:00
|
|
|
M_STRTO_NAN - Resolves to the internal libc function which
|
|
|
|
converts a string into the appropriate FLOAT nan
|
|
|
|
value.
|
2016-06-14 16:44:14 +00:00
|
|
|
|
|
|
|
declare_mgen_alias(from,to)
|
|
|
|
This exposes the appropriate symbol(s) for a
|
2017-10-09 22:04:18 +00:00
|
|
|
function f of type FLOAT.
|
|
|
|
|
|
|
|
declare_mgen_alias_r(from,to)
|
|
|
|
This exposes the appropriate symbol(s) for a
|
2018-05-16 04:03:08 +00:00
|
|
|
function f_r of type FLOAT.
|
|
|
|
|
|
|
|
SET_NAN_PAYLOAD(flt, mant)
|
|
|
|
Set the NaN payload bits of the variable FLT of type FLOAT to
|
|
|
|
the mantissa MANT. */
|
2016-06-14 16:44:14 +00:00
|
|
|
|
|
|
|
#ifndef M_PFX
|
|
|
|
# error "M_PFX must be defined."
|
|
|
|
#endif
|
|
|
|
#ifndef M_LIT
|
|
|
|
# error "M_LIT must be defined."
|
|
|
|
#endif
|
|
|
|
#ifndef M_MLIT
|
|
|
|
# error "M_MLIT must be defined."
|
|
|
|
#endif
|
|
|
|
#ifndef M_SUF
|
|
|
|
# error "M_SUF must be defined."
|
|
|
|
#endif
|
|
|
|
#ifndef FLOAT
|
|
|
|
# error "FLOAT must be defined."
|
|
|
|
#endif
|
|
|
|
#ifndef CFLOAT
|
|
|
|
# error "CFLOAT must be defined."
|
|
|
|
#endif
|
2017-10-09 22:04:18 +00:00
|
|
|
#ifndef declare_mgen_alias
|
|
|
|
# error "declare_mgen_alias must be defined."
|
|
|
|
#endif
|
|
|
|
#ifndef declare_mgen_alias_r
|
|
|
|
# error "declare_mgen_alias_r must be defined."
|
|
|
|
#endif
|
2018-05-16 04:03:08 +00:00
|
|
|
#ifndef SET_NAN_PAYLOAD
|
|
|
|
# error "SET_NAN_PAYLOAD must be defined."
|
|
|
|
#endif
|
2016-06-14 16:44:14 +00:00
|
|
|
|
2018-06-20 20:42:47 +00:00
|
|
|
#ifndef declare_mgen_finite_alias_x
|
|
|
|
#define declare_mgen_finite_alias_x(from, to) \
|
|
|
|
strong_alias (from, to ## _finite)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef declare_mgen_finite_alias_s
|
|
|
|
# define declare_mgen_finite_alias_s(from,to) \
|
|
|
|
declare_mgen_finite_alias_x (from, to)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef declare_mgen_finite_alias
|
|
|
|
# define declare_mgen_finite_alias(from, to) \
|
|
|
|
declare_mgen_finite_alias_s (M_SUF (from), M_SUF (to))
|
|
|
|
#endif
|
|
|
|
|
2016-06-14 16:44:14 +00:00
|
|
|
#define __M_CONCAT(a,b) a ## b
|
|
|
|
#define __M_CONCATX(a,b) __M_CONCAT(a,b)
|
|
|
|
|
2016-09-12 22:11:45 +00:00
|
|
|
#define M_NAN M_SUF (__builtin_nan) ("")
|
2017-05-16 16:34:34 +00:00
|
|
|
#define M_MIN_EXP __M_CONCATX (M_PFX, _MIN_EXP)
|
2016-06-14 16:44:14 +00:00
|
|
|
#define M_MAX_EXP __M_CONCATX (M_PFX, _MAX_EXP)
|
|
|
|
#define M_MIN __M_CONCATX (M_PFX, _MIN)
|
|
|
|
#define M_MAX __M_CONCATX (M_PFX, _MAX)
|
|
|
|
#define M_MANT_DIG __M_CONCATX (M_PFX, _MANT_DIG)
|
|
|
|
#define M_HUGE_VAL (M_SUF (__builtin_huge_val) ())
|
|
|
|
|
|
|
|
/* Helper macros for commonly used functions. */
|
2018-09-27 20:04:48 +00:00
|
|
|
#define M_COPYSIGN M_SUF (copysign)
|
2016-06-14 16:44:14 +00:00
|
|
|
#define M_FABS M_SUF (fabs)
|
|
|
|
#define M_SINCOS M_SUF (__sincos)
|
|
|
|
#define M_SCALBN M_SUF (__scalbn)
|
|
|
|
#define M_LOG1P M_SUF (__log1p)
|
|
|
|
|
|
|
|
#define M_ATAN2 M_SUF (__ieee754_atan2)
|
|
|
|
#define M_COSH M_SUF (__ieee754_cosh)
|
|
|
|
#define M_EXP M_SUF (__ieee754_exp)
|
|
|
|
#define M_HYPOT M_SUF (__ieee754_hypot)
|
|
|
|
#define M_LOG M_SUF (__ieee754_log)
|
|
|
|
#define M_SINH M_SUF (__ieee754_sinh)
|
2018-03-15 18:21:58 +00:00
|
|
|
#define M_SQRT M_SUF (sqrt)
|
2016-06-14 16:44:14 +00:00
|
|
|
|
|
|
|
/* Needed to evaluate M_MANT_DIG below. */
|
|
|
|
#include <float.h>
|
|
|
|
|
|
|
|
/* Use a special epsilon value for IBM long double
|
|
|
|
to avoid spurious overflows/underflows. */
|
|
|
|
#if M_MANT_DIG != 106
|
|
|
|
# define M_EPSILON __M_CONCATX (M_PFX, _EPSILON)
|
|
|
|
#else
|
|
|
|
# define M_EPSILON M_LIT (0x1p-106)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Enable overloading of function name to assist reuse. */
|
|
|
|
#ifndef M_DECL_FUNC
|
|
|
|
# define M_DECL_FUNC(f) M_SUF (f)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _MATH_TYPE_MACROS */
|