1996-03-05 21:41:30 +00:00
|
|
|
/*
|
|
|
|
* ====================================================
|
|
|
|
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
|
|
*
|
|
|
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
|
|
* Permission to use, copy, modify, and distribute this
|
|
|
|
* software is freely granted, provided that this notice
|
|
|
|
* is preserved.
|
|
|
|
* ====================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* from: @(#)fdlibm.h 5.1 93/09/24
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MATH_PRIVATE_H_
|
|
|
|
#define _MATH_PRIVATE_H_
|
|
|
|
|
1999-07-14 00:54:57 +00:00
|
|
|
#include <endian.h>
|
2009-08-25 01:05:48 +00:00
|
|
|
#include <stdint.h>
|
1996-03-05 21:41:30 +00:00
|
|
|
#include <sys/types.h>
|
2012-03-09 20:51:27 +00:00
|
|
|
#include <fenv.h>
|
2015-09-18 20:00:48 +00:00
|
|
|
#include <float.h>
|
2014-06-23 16:15:41 +00:00
|
|
|
#include <get-rounding-mode.h>
|
1996-03-05 21:41:30 +00:00
|
|
|
|
|
|
|
/* The original fdlibm code used statements like:
|
|
|
|
n0 = ((*(int*)&one)>>29)^1; * index of high word *
|
|
|
|
ix0 = *(n0+(int*)&x); * high word of x *
|
|
|
|
ix1 = *((1-n0)+(int*)&x); * low word of x *
|
|
|
|
to dig two 32 bit words out of the 64 bit IEEE floating point
|
|
|
|
value. That is non-ANSI, and, moreover, the gcc instruction
|
|
|
|
scheduler gets it wrong. We instead use the following macros.
|
|
|
|
Unlike the original code, we determine the endianness at compile
|
|
|
|
time, not at run time; I don't see much benefit to selecting
|
|
|
|
endianness at run time. */
|
|
|
|
|
|
|
|
/* A union which permits us to convert between a double and two 32 bit
|
|
|
|
ints. */
|
|
|
|
|
1998-11-27 11:34:40 +00:00
|
|
|
#if __FLOAT_WORD_ORDER == BIG_ENDIAN
|
1996-03-05 21:41:30 +00:00
|
|
|
|
|
|
|
typedef union
|
|
|
|
{
|
|
|
|
double value;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
u_int32_t msw;
|
|
|
|
u_int32_t lsw;
|
|
|
|
} parts;
|
2009-08-25 01:05:48 +00:00
|
|
|
uint64_t word;
|
1996-03-05 21:41:30 +00:00
|
|
|
} ieee_double_shape_type;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
1998-11-27 11:34:40 +00:00
|
|
|
#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
|
1996-03-05 21:41:30 +00:00
|
|
|
|
|
|
|
typedef union
|
|
|
|
{
|
|
|
|
double value;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
u_int32_t lsw;
|
|
|
|
u_int32_t msw;
|
|
|
|
} parts;
|
2009-08-25 01:05:48 +00:00
|
|
|
uint64_t word;
|
1996-03-05 21:41:30 +00:00
|
|
|
} ieee_double_shape_type;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Get two 32 bit ints from a double. */
|
|
|
|
|
|
|
|
#define EXTRACT_WORDS(ix0,ix1,d) \
|
|
|
|
do { \
|
|
|
|
ieee_double_shape_type ew_u; \
|
|
|
|
ew_u.value = (d); \
|
|
|
|
(ix0) = ew_u.parts.msw; \
|
|
|
|
(ix1) = ew_u.parts.lsw; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/* Get the more significant 32 bit int from a double. */
|
|
|
|
|
2012-03-09 20:38:23 +00:00
|
|
|
#ifndef GET_HIGH_WORD
|
|
|
|
# define GET_HIGH_WORD(i,d) \
|
1996-03-05 21:41:30 +00:00
|
|
|
do { \
|
|
|
|
ieee_double_shape_type gh_u; \
|
|
|
|
gh_u.value = (d); \
|
|
|
|
(i) = gh_u.parts.msw; \
|
|
|
|
} while (0)
|
2012-03-09 20:38:23 +00:00
|
|
|
#endif
|
1996-03-05 21:41:30 +00:00
|
|
|
|
|
|
|
/* Get the less significant 32 bit int from a double. */
|
|
|
|
|
2012-03-09 20:38:23 +00:00
|
|
|
#ifndef GET_LOW_WORD
|
|
|
|
# define GET_LOW_WORD(i,d) \
|
1996-03-05 21:41:30 +00:00
|
|
|
do { \
|
|
|
|
ieee_double_shape_type gl_u; \
|
|
|
|
gl_u.value = (d); \
|
|
|
|
(i) = gl_u.parts.lsw; \
|
|
|
|
} while (0)
|
2012-03-09 20:38:23 +00:00
|
|
|
#endif
|
1996-03-05 21:41:30 +00:00
|
|
|
|
2009-08-25 01:05:48 +00:00
|
|
|
/* Get all in one, efficient on 64-bit machines. */
|
2012-03-09 20:38:23 +00:00
|
|
|
#ifndef EXTRACT_WORDS64
|
|
|
|
# define EXTRACT_WORDS64(i,d) \
|
2009-08-25 01:05:48 +00:00
|
|
|
do { \
|
|
|
|
ieee_double_shape_type gh_u; \
|
|
|
|
gh_u.value = (d); \
|
|
|
|
(i) = gh_u.word; \
|
|
|
|
} while (0)
|
2012-03-09 20:38:23 +00:00
|
|
|
#endif
|
2009-08-25 01:05:48 +00:00
|
|
|
|
1996-03-05 21:41:30 +00:00
|
|
|
/* Set a double from two 32 bit ints. */
|
2012-03-09 20:38:23 +00:00
|
|
|
#ifndef INSERT_WORDS
|
|
|
|
# define INSERT_WORDS(d,ix0,ix1) \
|
1996-03-05 21:41:30 +00:00
|
|
|
do { \
|
|
|
|
ieee_double_shape_type iw_u; \
|
|
|
|
iw_u.parts.msw = (ix0); \
|
|
|
|
iw_u.parts.lsw = (ix1); \
|
|
|
|
(d) = iw_u.value; \
|
|
|
|
} while (0)
|
2012-03-09 20:38:23 +00:00
|
|
|
#endif
|
1996-03-05 21:41:30 +00:00
|
|
|
|
2009-08-25 01:05:48 +00:00
|
|
|
/* Get all in one, efficient on 64-bit machines. */
|
2012-03-09 20:38:23 +00:00
|
|
|
#ifndef INSERT_WORDS64
|
|
|
|
# define INSERT_WORDS64(d,i) \
|
2009-08-25 01:05:48 +00:00
|
|
|
do { \
|
|
|
|
ieee_double_shape_type iw_u; \
|
|
|
|
iw_u.word = (i); \
|
|
|
|
(d) = iw_u.value; \
|
|
|
|
} while (0)
|
2012-03-09 20:38:23 +00:00
|
|
|
#endif
|
2009-08-25 01:05:48 +00:00
|
|
|
|
1996-03-05 21:41:30 +00:00
|
|
|
/* Set the more significant 32 bits of a double from an int. */
|
2012-03-09 20:38:23 +00:00
|
|
|
#ifndef SET_HIGH_WORD
|
1996-03-05 21:41:30 +00:00
|
|
|
#define SET_HIGH_WORD(d,v) \
|
|
|
|
do { \
|
|
|
|
ieee_double_shape_type sh_u; \
|
|
|
|
sh_u.value = (d); \
|
|
|
|
sh_u.parts.msw = (v); \
|
|
|
|
(d) = sh_u.value; \
|
|
|
|
} while (0)
|
2012-03-09 20:38:23 +00:00
|
|
|
#endif
|
1996-03-05 21:41:30 +00:00
|
|
|
|
|
|
|
/* Set the less significant 32 bits of a double from an int. */
|
2012-03-09 20:38:23 +00:00
|
|
|
#ifndef SET_LOW_WORD
|
|
|
|
# define SET_LOW_WORD(d,v) \
|
1996-03-05 21:41:30 +00:00
|
|
|
do { \
|
|
|
|
ieee_double_shape_type sl_u; \
|
|
|
|
sl_u.value = (d); \
|
|
|
|
sl_u.parts.lsw = (v); \
|
|
|
|
(d) = sl_u.value; \
|
|
|
|
} while (0)
|
2012-03-09 20:38:23 +00:00
|
|
|
#endif
|
1996-03-05 21:41:30 +00:00
|
|
|
|
|
|
|
/* A union which permits us to convert between a float and a 32 bit
|
|
|
|
int. */
|
|
|
|
|
|
|
|
typedef union
|
|
|
|
{
|
|
|
|
float value;
|
|
|
|
u_int32_t word;
|
|
|
|
} ieee_float_shape_type;
|
|
|
|
|
|
|
|
/* Get a 32 bit int from a float. */
|
2012-03-09 20:38:23 +00:00
|
|
|
#ifndef GET_FLOAT_WORD
|
|
|
|
# define GET_FLOAT_WORD(i,d) \
|
1996-03-05 21:41:30 +00:00
|
|
|
do { \
|
|
|
|
ieee_float_shape_type gf_u; \
|
|
|
|
gf_u.value = (d); \
|
|
|
|
(i) = gf_u.word; \
|
|
|
|
} while (0)
|
2012-03-09 20:38:23 +00:00
|
|
|
#endif
|
1996-03-05 21:41:30 +00:00
|
|
|
|
|
|
|
/* Set a float from a 32 bit int. */
|
2012-03-09 20:38:23 +00:00
|
|
|
#ifndef SET_FLOAT_WORD
|
|
|
|
# define SET_FLOAT_WORD(d,i) \
|
1996-03-05 21:41:30 +00:00
|
|
|
do { \
|
|
|
|
ieee_float_shape_type sf_u; \
|
|
|
|
sf_u.word = (i); \
|
|
|
|
(d) = sf_u.value; \
|
|
|
|
} while (0)
|
2012-03-09 20:38:23 +00:00
|
|
|
#endif
|
1996-03-05 21:41:30 +00:00
|
|
|
|
1999-07-14 00:54:57 +00:00
|
|
|
/* Get long double macros from a separate header. */
|
|
|
|
#include <math_ldbl.h>
|
Thu May 30 11:24:05 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* po/header.pot: Replace with exact boilerplate pinard dictates.
* sysdeps/i386/strtok.S (Lillegal_argument): Remove this code to set
errno and the check that jumped to it.
* sysdeps/mach/hurd/Makefile (errnos.d): Use $(sed-remove-objpfx).
Thu May 30 03:21:57 1996 Ulrich Drepper <drepper@cygnus.com>
* FAQ: Document need of gperf program for developers.
* elf/elf.h: Fix typos in comments.
* libio/stdio.h [!__STRICT_ANSI__ || _POSIX_SOURCE]: Add
prototypes for `ctermid' and `cuserid'.
* locale/programs/locale.c: Switch to user selected locale
before printing variables.
* math/Makefile [$(long-double-fcts)==yes]: Define long-m-routines
and long-c-routines. Only if the `long double' data type is
available we need to compile the functions.
(libm-routines): Add $(long-m-routines).
(routines): Remove isinfl, isnanl. Use new file s_isinfl and
s_isnanl instead if `long double' is available.
* math/math.h: Include <mathcalls.h> again to define `long double'
functions.
* math/math_private.h: Define data types, prototypes and access
macros for `long double'.
* stdlib/stdlib.h: Add prototypes for `strtoll' and `strtoull'.
[GCC2 && OPTIMIZE]: Define strto{,u}ll as inline function which
calls __strto{,u}q_internal.
* stdlib/strfmon.c: Replace PTR by `void *'.
* stdlib/strtoq.c: Define strtoll as weak alias.
* stdlib/strtouq.c: Define strtoull as weak alias.
* string/tester.c: Correct `strsep' test.
* sysdeps/generic/strsep.c: Make compatible with BSD version.
Trailing characters of skip set are not skipped. In this case
empty tokens are returned.
* sysdeps/i386/isinfl.c, sysdeps/i386/isnanl.c,
sysdeps/ieee754/isinf.c, sysdeps/ieee754/isinfl.c,
sysdeps/ieee754/isnan.c, sysdeps/ieee754/isnanl.c: Removed. We
now use the versions part of libm.
* sysdeps/i386/strsep.S: Removed. Generic C version is of
similar speed.
* sysdeps/i386/strtok.S: Remove support for `strsep'.
* sysdeps/libm-i387/e_acosl.S, sysdeps/libm-i387/s_ceill.S,
sysdeps/libm-i387/s_copysignl.S, sysdeps/libm-i387/s_finitel.S,
sysdeps/libm-i387/s_floorl.S, sysdeps/libm-i387/s_isinfl.c,
sysdeps/libm-i387/s_isnanl.c, sysdeps/libm-i387/s_nextafterl.c,
sysdeps/libm-i387/s_rintl.S, sysdeps/libm-i387/s_significandl.S:
New i387 specific math functions implementing `long double'
versions.
* sysdeps/libm-ieee754/s_ceill.c,
sysdeps/libm-ieee754/s_copysignl.c,
sysdeps/libm-ieee754/s_fabsl.c, sysdeps/libm-ieee754/s_finitel.c,
sysdeps/libm-ieee754/s_floorl.c, sysdeps/libm-ieee754/s_isinfl.c,
sysdeps/libm-ieee754/s_isnanl.c,
sysdeps/libm-ieee754/s_nextafterl.c,
sysdeps/libm-ieee754/s_rintl.c, sysdeps/libm-ieee754/s_scalbnl.c,
sysdeps/libm-ieee754/s_significandl.c: New generic `long double'
versions of libm functions.
* sysdeps/libm-i387/e_exp.S: Add a few comments to explain the
Intel FPU nonsense.
* sysdeps/libm-i387/s_ceil.S, sysdeps/libm-i387/s_ceilf.S,
sysdeps/libm-i387/s_floor.S, sysdeps/libm-i387/s_floorf.S: Correct
handling of local variables. The old version created a stack
frame but stored the values outside.
* sysdeps/libm-ieee754/s_isinf.c, sysdeps/libm-ieee754/s_isnan.c
[!NO_LONG_DOUBLE]: Define alias with `long double' versions name.
* login/pututline_r.c: Include sys/stat.h. Fix typos.
according to currently used locale for category LC_CTYPE by
inet_nsap_ntoa. Now in <arpa/inet.h>.
_IO_dup2 to contain complete parameter list.
1996-05-30 16:12:42 +00:00
|
|
|
|
1996-03-05 21:41:30 +00:00
|
|
|
/* ieee style elementary functions */
|
1999-10-09 21:56:43 +00:00
|
|
|
extern double __ieee754_sqrt (double);
|
|
|
|
extern double __ieee754_acos (double);
|
|
|
|
extern double __ieee754_acosh (double);
|
|
|
|
extern double __ieee754_log (double);
|
|
|
|
extern double __ieee754_atanh (double);
|
|
|
|
extern double __ieee754_asin (double);
|
|
|
|
extern double __ieee754_atan2 (double,double);
|
|
|
|
extern double __ieee754_exp (double);
|
|
|
|
extern double __ieee754_exp2 (double);
|
|
|
|
extern double __ieee754_exp10 (double);
|
|
|
|
extern double __ieee754_cosh (double);
|
|
|
|
extern double __ieee754_fmod (double,double);
|
|
|
|
extern double __ieee754_pow (double,double);
|
|
|
|
extern double __ieee754_lgamma_r (double,int *);
|
|
|
|
extern double __ieee754_gamma_r (double,int *);
|
|
|
|
extern double __ieee754_lgamma (double);
|
|
|
|
extern double __ieee754_gamma (double);
|
|
|
|
extern double __ieee754_log10 (double);
|
Update.
2001-06-04 Bruno Haible <haible@clisp.cons.org>
* iconv/loop.c (UNICODE_TAG_HANDLER): New macro.
* iconv/gconv_simple.c (__gconv_transform_internal_ascii): Invoke
UNICODE_TAG_HANDLER.
(__gconv_transform_internal_ucs2): Likewise.
(__gconv_transform_internal_ucs2reverse): Likewise.
* iconvdata/8bit-gap.c (BODY for TO_LOOP): Invoke UNICODE_TAG_HANDLER.
* iconvdata/8bit-generic.c (BODY for TO_LOOP): Likewise.
* iconvdata/ansi_x3.110.c (BODY for TO_LOOP): Likewise.
* iconvdata/big5.c (BODY for TO_LOOP): Likewise.
* iconvdata/big5hkscs.c (BODY for TO_LOOP): Likewise.
* iconvdata/cp1255.c (BODY for TO_LOOP): Likewise.
* iconvdata/cp1258.c (BODY for TO_LOOP): Likewise.
* iconvdata/euc-cn.c (BODY for TO_LOOP): Likewise.
* iconvdata/euc-jp.c (BODY for TO_LOOP): Likewise.
* iconvdata/euc-kr.c (BODY for TO_LOOP): Likewise.
* iconvdata/euc-tw.c (BODY for TO_LOOP): Likewise.
* iconvdata/gbk.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm930.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm932.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm933.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm935.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm937.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm939.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm943.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso646.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso8859-1.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso_6937.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso_6937-2.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso-2022-cn.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso-2022-cn-ext.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso-2022-kr.c (BODY for TO_LOOP): Likewise.
* iconvdata/johab.c (BODY for TO_LOOP): Likewise.
* iconvdata/sjis.c (BODY for TO_LOOP): Likewise.
* iconvdata/t.61.c (BODY for TO_LOOP): Likewise.
* iconvdata/uhc.c (BODY for TO_LOOP): Likewise.
* iconvdata/unicode.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso-2022-jp.c (TAG_none, TAG_language, TAG_language_j,
TAG_language_ja, TAG_language_k, TAG_language_ko, TAG_language_z,
TAG_language_zh, CURRENT_TAG_MASK): New enum values.
(EMIT_SHIFT_TO_INIT): Don't emit an escape sequence if ASCII_set
is already selected but set2 or tag are set.
(conversion): New enum type.
(cvlist_t): New type.
(CVLIST, CVLIST_FIRST, CVLIST_REST): New macros.
(conversion_lists): New array.
(BODY for TO_LOOP): Keep track of Unicode 3.1 language tag. If "ja",
prefer conversion to Japanese character sets. If "zh", prefer
conversion to GB2312. If "ko", prefer conversion to KSC5601. Small
optimizations.
(INIT_PARAMS): Add tag.
(UPDATE_PARAMS): Add tag.
2001-06-04 Bruno Haible <haible@clisp.cons.org>
* locale/programs/locfile.c (write_locale_data): Before creat(),
unlink the file, to avoid crashing the processes that mmap it. Change
a double slash to a single slash. Free fname in case of error return.
2001-06-02 Jakub Jelinek <jakub@redhat.com>
* sysdeps/i386/fpu/s_frexpl.S (__frexpl): Mostly revert 2000-12-03
changes, do the special handling for denormal numbers, not for
normalized numbers (patch by <trevin@xmission.com>).
* math/test-misc.c (main): Test frexpl with denormal arguments.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* math/libm-test.inc (llround_test): Add two new llround tests.
* sysdeps/ieee754/ldbl-96/s_llroundl.c (__llroundl): Don't allow
overflow when rounding away from zero.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* math/Makefile (libm-calls): Add e_log2, w_log2, remove s_log2.
* math/math_private.h (__ieee754_log2, __ieee754_log2f,
__ieee754_log2l): New prototypes.
* sysdeps/generic/w_log2.c: New file.
* sysdeps/generic/w_log2f.c: New file.
* sysdeps/generic/w_log2l.c: New file.
* sysdeps/generic/s_log2l.c: Move...
* sysdeps/generic/e_log2l.c: ...to here. Rename to __ieee754_log2l.
* sysdeps/ieee754/k_standard.c (__kernel_standard): Handle log2(0)
and log2(x < 0).
* sysdeps/i386/fpu/s_log2.S: Move...
* sysdeps/i386/fpu/e_log2.S: ...to here. Rename to __ieee754_log2.
* sysdeps/i386/fpu/s_log2f.S: Move...
* sysdeps/i386/fpu/e_log2f.S: ...to here. Rename to __ieee754_log2f.
* sysdeps/i386/fpu/s_log2l.S: Move...
* sysdeps/i386/fpu/e_log2l.S: ...to here. Rename to __ieee754_log2l.
* sysdeps/m68k/fpu/s_log2.S: Move...
* sysdeps/m68k/fpu/e_log2.S: ...to here. Rename to __ieee754_log2.
* sysdeps/m68k/fpu/s_log2f.S: Move...
* sysdeps/m68k/fpu/e_log2f.S: ...to here. Rename to __ieee754_log2f.
* sysdeps/m68k/fpu/s_log2l.S: Move...
* sysdeps/m68k/fpu/e_log2l.S: ...to here. Rename to __ieee754_log2l.
* sysdeps/ieee754/dbl-64/s_log2.c: Move...
* sysdeps/ieee754/dbl-64/e_log2.c: ...to here. Rename to
__ieee754_log2.
* sysdeps/ieee754/flt-32/s_log2f.c: Move...
* sysdeps/ieee754/flt-32/e_log2f.c: ...to here. Rename to
__ieee754_log2f.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* sysdeps/generic/w_exp2.c (u_threshold): Lower threshold so that
even arguments which result in denormalized exp2 are accepted.
(__exp2): Arguments equal to u_threshold already result into
underflow.
* sysdeps/generic/w_exp2f.c (u_threshold, __exp2f): Likewise.
* sysdeps/generic/w_exp2l.c (u_threshold, __exp2l): Likewise.
* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Lomark was too
low, with corrected lowmark use greaterequal, not greater.
* sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Likewise.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* math/libm-test.inc (ilogb_test): Test that ilogb(+-Inf) == INT_MAX.
* sysdeps/i386/fpu/s_ilogb.S (__ilogb): Return INT_MAX for +-Inf.
* sysdeps/i386/fpu/s_ilogbf.S (__ilogbf): Likewise.
* sysdeps/i386/fpu/s_ilogbl.S (__ilogbl): Likewise.
* sysdeps/ieee754/dbl-64/s_ilogb.c (__ilogb): Likewise.
* sysdeps/ieee754/flt-32/s_ilogbf.c (__ilogbf): Likewise.
* sysdeps/ieee754/ldbl-128/s_ilogbl.c (__ilogbl): Likewise.
* sysdeps/ieee754/ldbl-96/s_ilogbl.c (__ilogbl): Likewise.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* sysdeps/generic/w_coshl.c (__coshl): Test if finite argument
gave non-finite result instead of using constant in generic
version.
* sysdeps/generic/w_coshf.c (__coshf): Likewise.
* sysdeps/generic/w_cosh.c (__cosh): Likewise.
* sysdeps/generic/w_exp10.c (o_threshold, u_threshold): Remove.
(__exp10): Test if finite argument gave non-finite result.
* sysdeps/generic/w_exp10f.c (o_threshold, u_threshold, __exp10f):
Likewise.
* sysdeps/generic/w_exp10l.c (o_threshold, u_threshold, __exp10l):
Likewise.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* sysdeps/ieee754/ldbl-96/e_coshl.c (__ieee754_coshl): Fix
overflow threshold constant (log(LDBL_MAX)+M_LN2l).
2001-05-29 Bruno Haible <haible@clisp.cons.org>
* locale/programs/ld-ctype.c (idx_table): New struct type.
(idx_table_init, idx_table_get, idx_table_add): New functions.
(MAX_CHARNAMES_IDX): Remove macro.
(locale_ctype_t): Change type of charnames_idx field.
(ctype_startup): Change initialization of charnames_idx field.
(find_idx): Use idx_table_get and idx_table_add for speed.
* locale/programs/charmap.c (charmap_new_char): Fix ucs4 value
computation of characters in a range.
2001-05-29 Bruno Haible <haible@clisp.cons.org>
* iconvdata/gb18030.c (__fourbyte_to_ucs1): Add mappings for <U03F4>,
<U03F5>.
(__ucs_to_gb18030_tab1): Likewise.
(BODY for FROM_LOOP): Add mapping for <U00010000>..<U0010FFFF>.
(BODY for TO_LOOP): Likewise.
* iconvdata/tst-table-charmap.sh: Update for charmaps containing
<U00xxxxxx> syntax.
* iconvdata/tst-table-from.c (bmp_only): New variable.
(utf8_decode): If bmp_only, don't return characters outside Unicode
plane 0.
(main): When testing UTF-8 or GB18030, set bmp_only to 1. Don't print
a conversion line if utf8_decode returns NULL.
* iconvdata/tst-table-to.c (main): When testing encodings other than
UTF-8 and GB18030, loop upto U+30000 instead of U+10000. Use UTF-8
instead of UCS-2 as input.
* iconvdata/tst-table.sh: For GB18030, use only the part < 0x10000
of the charmap.
2001-05-29 Bruno Haible <haible@clisp.cons.org>
* iconvdata/cns11643l1.c: Update to Unicode 3.1.
(__cns11643l1_to_ucs4_tab): Regenerated.
(__cns11643l1_from_ucs4_tab12): Regenerated.
* iconvdata/cns11643.c: Update to Unicode 3.1.
(__cns11643l14_to_ucs4_tab): Remove array.
(__cns11643l3_to_ucs4_tab, __cns11643l4_to_ucs4_tab,
__cns11643l5_to_ucs4_tab, __cns11643l6_to_ucs4_tab,
__cns11643l7_to_ucs4_tab, __cns11643l15_to_ucs4_tab): New arrays.
(__cns11643_from_ucs4p0_tab): Renamed from __cns11643_from_ucs4_tab.
(__cns11643_from_ucs4p2_tab): New array.
* iconvdata/cns11643.h (__cns11643l14_to_ucs4_tab): Remove declaration.
(__cns11643l3_to_ucs4_tab, __cns11643l4_to_ucs4_tab,
__cns11643l5_to_ucs4_tab, __cns11643l6_to_ucs4_tab,
__cns11643l7_to_ucs4_tab, __cns11643l15_to_ucs4_tab): New declarations.
(cns11643_to_ucs4): Treat planes 3, 4, 5, 6, 7, 15 instead of 14.
(__cns11643_from_ucs4_tab): Remove declaration.
(__cns11643_from_ucs4p0_tab, __cns11643_from_ucs4p2_tab): New
declarations.
(ucs4_to_cns11643): Update for new arrays. Treat U+3400..U+4DFF and
U+20000..U+2A6D6.
* iconvdata/cns11643l2.h (__cns11643_from_ucs4_tab): Remove
declaration.
(__cns11643_from_ucs4p0_tab): New declaration.
(ucs4_to_cns11643l2): Update for new arrays.
* iconvdata/iso-2022-cn-ext.c (BODY for FROM_LOOP): Handle planes
3 to 7.
(BODY for TO_LOOP): Handle planes 3 to 7, instead of plane 14.
* iconvdata/EUC-TW.irreversible: New file.
* iconvdata/tst-table.sh: Use it.
* iconvdata/Makefile (distribute): Add CP1255.irreversible,
CP1258.irreversible, EUC-TW.irreversible.
2001-05-29 Bruno Haible <haible@clisp.cons.org>
* locale/C-translit.h.in: Add transliterations for new Unicode 3.1
mathematical symbols.
2001-06-06 12:55:46 +00:00
|
|
|
extern double __ieee754_log2 (double);
|
1999-10-09 21:56:43 +00:00
|
|
|
extern double __ieee754_sinh (double);
|
|
|
|
extern double __ieee754_hypot (double,double);
|
|
|
|
extern double __ieee754_j0 (double);
|
|
|
|
extern double __ieee754_j1 (double);
|
|
|
|
extern double __ieee754_y0 (double);
|
|
|
|
extern double __ieee754_y1 (double);
|
|
|
|
extern double __ieee754_jn (int,double);
|
|
|
|
extern double __ieee754_yn (int,double);
|
|
|
|
extern double __ieee754_remainder (double,double);
|
|
|
|
extern int32_t __ieee754_rem_pio2 (double,double*);
|
|
|
|
extern double __ieee754_scalb (double,double);
|
2012-04-11 19:30:13 +00:00
|
|
|
extern int __ieee754_ilogb (double);
|
1996-03-05 21:41:30 +00:00
|
|
|
|
|
|
|
/* fdlibm kernel function */
|
1999-10-09 21:56:43 +00:00
|
|
|
extern double __kernel_standard (double,double,int);
|
2011-10-12 15:27:51 +00:00
|
|
|
extern float __kernel_standard_f (float,float,int);
|
2012-03-28 09:32:12 +00:00
|
|
|
extern long double __kernel_standard_l (long double,long double,int);
|
1999-10-09 21:56:43 +00:00
|
|
|
extern double __kernel_sin (double,double,int);
|
|
|
|
extern double __kernel_cos (double,double);
|
|
|
|
extern double __kernel_tan (double,double,int);
|
|
|
|
extern int __kernel_rem_pio2 (double*,double*,int,int,int, const int32_t*);
|
1996-03-05 21:41:30 +00:00
|
|
|
|
2001-05-12 14:32:12 +00:00
|
|
|
/* internal functions. */
|
|
|
|
extern double __copysign (double x, double __y);
|
|
|
|
|
* math/math_private.h (__copysign): Define as builtin for gcc 4. (__copysignf, __copysignl): Likewise. * sysdeps/alpha/fpu/bits/mathinline.h (copysign): Don't define for gcc 4.0. (copysignf, copysignl, fabsf, fabs): Likewise. (__copysign, __copysignf, __copysignl): Remove. (__fabs, __fabsf): Remove.
2005-01-07 Richard Henderson <rth@redhat.com>
* math/math_private.h (__copysign): Define as builtin for gcc 4.
(__copysignf, __copysignl): Likewise.
* sysdeps/alpha/fpu/bits/mathinline.h (copysign): Don't define
for gcc 4.0.
(copysignf, copysignl, fabsf, fabs): Likewise.
(__copysign, __copysignf, __copysignl): Remove.
(__fabs, __fabsf): Remove.
2005-02-08 04:37:48 +00:00
|
|
|
extern inline double __copysign (double x, double y)
|
|
|
|
{ return __builtin_copysign (x, y); }
|
1996-03-05 21:41:30 +00:00
|
|
|
|
|
|
|
/* ieee style elementary float functions */
|
1999-10-09 21:56:43 +00:00
|
|
|
extern float __ieee754_sqrtf (float);
|
|
|
|
extern float __ieee754_acosf (float);
|
|
|
|
extern float __ieee754_acoshf (float);
|
|
|
|
extern float __ieee754_logf (float);
|
|
|
|
extern float __ieee754_atanhf (float);
|
|
|
|
extern float __ieee754_asinf (float);
|
|
|
|
extern float __ieee754_atan2f (float,float);
|
|
|
|
extern float __ieee754_expf (float);
|
|
|
|
extern float __ieee754_exp2f (float);
|
|
|
|
extern float __ieee754_exp10f (float);
|
|
|
|
extern float __ieee754_coshf (float);
|
|
|
|
extern float __ieee754_fmodf (float,float);
|
|
|
|
extern float __ieee754_powf (float,float);
|
|
|
|
extern float __ieee754_lgammaf_r (float,int *);
|
|
|
|
extern float __ieee754_gammaf_r (float,int *);
|
|
|
|
extern float __ieee754_lgammaf (float);
|
|
|
|
extern float __ieee754_gammaf (float);
|
|
|
|
extern float __ieee754_log10f (float);
|
Update.
2001-06-04 Bruno Haible <haible@clisp.cons.org>
* iconv/loop.c (UNICODE_TAG_HANDLER): New macro.
* iconv/gconv_simple.c (__gconv_transform_internal_ascii): Invoke
UNICODE_TAG_HANDLER.
(__gconv_transform_internal_ucs2): Likewise.
(__gconv_transform_internal_ucs2reverse): Likewise.
* iconvdata/8bit-gap.c (BODY for TO_LOOP): Invoke UNICODE_TAG_HANDLER.
* iconvdata/8bit-generic.c (BODY for TO_LOOP): Likewise.
* iconvdata/ansi_x3.110.c (BODY for TO_LOOP): Likewise.
* iconvdata/big5.c (BODY for TO_LOOP): Likewise.
* iconvdata/big5hkscs.c (BODY for TO_LOOP): Likewise.
* iconvdata/cp1255.c (BODY for TO_LOOP): Likewise.
* iconvdata/cp1258.c (BODY for TO_LOOP): Likewise.
* iconvdata/euc-cn.c (BODY for TO_LOOP): Likewise.
* iconvdata/euc-jp.c (BODY for TO_LOOP): Likewise.
* iconvdata/euc-kr.c (BODY for TO_LOOP): Likewise.
* iconvdata/euc-tw.c (BODY for TO_LOOP): Likewise.
* iconvdata/gbk.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm930.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm932.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm933.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm935.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm937.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm939.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm943.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso646.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso8859-1.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso_6937.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso_6937-2.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso-2022-cn.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso-2022-cn-ext.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso-2022-kr.c (BODY for TO_LOOP): Likewise.
* iconvdata/johab.c (BODY for TO_LOOP): Likewise.
* iconvdata/sjis.c (BODY for TO_LOOP): Likewise.
* iconvdata/t.61.c (BODY for TO_LOOP): Likewise.
* iconvdata/uhc.c (BODY for TO_LOOP): Likewise.
* iconvdata/unicode.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso-2022-jp.c (TAG_none, TAG_language, TAG_language_j,
TAG_language_ja, TAG_language_k, TAG_language_ko, TAG_language_z,
TAG_language_zh, CURRENT_TAG_MASK): New enum values.
(EMIT_SHIFT_TO_INIT): Don't emit an escape sequence if ASCII_set
is already selected but set2 or tag are set.
(conversion): New enum type.
(cvlist_t): New type.
(CVLIST, CVLIST_FIRST, CVLIST_REST): New macros.
(conversion_lists): New array.
(BODY for TO_LOOP): Keep track of Unicode 3.1 language tag. If "ja",
prefer conversion to Japanese character sets. If "zh", prefer
conversion to GB2312. If "ko", prefer conversion to KSC5601. Small
optimizations.
(INIT_PARAMS): Add tag.
(UPDATE_PARAMS): Add tag.
2001-06-04 Bruno Haible <haible@clisp.cons.org>
* locale/programs/locfile.c (write_locale_data): Before creat(),
unlink the file, to avoid crashing the processes that mmap it. Change
a double slash to a single slash. Free fname in case of error return.
2001-06-02 Jakub Jelinek <jakub@redhat.com>
* sysdeps/i386/fpu/s_frexpl.S (__frexpl): Mostly revert 2000-12-03
changes, do the special handling for denormal numbers, not for
normalized numbers (patch by <trevin@xmission.com>).
* math/test-misc.c (main): Test frexpl with denormal arguments.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* math/libm-test.inc (llround_test): Add two new llround tests.
* sysdeps/ieee754/ldbl-96/s_llroundl.c (__llroundl): Don't allow
overflow when rounding away from zero.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* math/Makefile (libm-calls): Add e_log2, w_log2, remove s_log2.
* math/math_private.h (__ieee754_log2, __ieee754_log2f,
__ieee754_log2l): New prototypes.
* sysdeps/generic/w_log2.c: New file.
* sysdeps/generic/w_log2f.c: New file.
* sysdeps/generic/w_log2l.c: New file.
* sysdeps/generic/s_log2l.c: Move...
* sysdeps/generic/e_log2l.c: ...to here. Rename to __ieee754_log2l.
* sysdeps/ieee754/k_standard.c (__kernel_standard): Handle log2(0)
and log2(x < 0).
* sysdeps/i386/fpu/s_log2.S: Move...
* sysdeps/i386/fpu/e_log2.S: ...to here. Rename to __ieee754_log2.
* sysdeps/i386/fpu/s_log2f.S: Move...
* sysdeps/i386/fpu/e_log2f.S: ...to here. Rename to __ieee754_log2f.
* sysdeps/i386/fpu/s_log2l.S: Move...
* sysdeps/i386/fpu/e_log2l.S: ...to here. Rename to __ieee754_log2l.
* sysdeps/m68k/fpu/s_log2.S: Move...
* sysdeps/m68k/fpu/e_log2.S: ...to here. Rename to __ieee754_log2.
* sysdeps/m68k/fpu/s_log2f.S: Move...
* sysdeps/m68k/fpu/e_log2f.S: ...to here. Rename to __ieee754_log2f.
* sysdeps/m68k/fpu/s_log2l.S: Move...
* sysdeps/m68k/fpu/e_log2l.S: ...to here. Rename to __ieee754_log2l.
* sysdeps/ieee754/dbl-64/s_log2.c: Move...
* sysdeps/ieee754/dbl-64/e_log2.c: ...to here. Rename to
__ieee754_log2.
* sysdeps/ieee754/flt-32/s_log2f.c: Move...
* sysdeps/ieee754/flt-32/e_log2f.c: ...to here. Rename to
__ieee754_log2f.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* sysdeps/generic/w_exp2.c (u_threshold): Lower threshold so that
even arguments which result in denormalized exp2 are accepted.
(__exp2): Arguments equal to u_threshold already result into
underflow.
* sysdeps/generic/w_exp2f.c (u_threshold, __exp2f): Likewise.
* sysdeps/generic/w_exp2l.c (u_threshold, __exp2l): Likewise.
* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Lomark was too
low, with corrected lowmark use greaterequal, not greater.
* sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Likewise.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* math/libm-test.inc (ilogb_test): Test that ilogb(+-Inf) == INT_MAX.
* sysdeps/i386/fpu/s_ilogb.S (__ilogb): Return INT_MAX for +-Inf.
* sysdeps/i386/fpu/s_ilogbf.S (__ilogbf): Likewise.
* sysdeps/i386/fpu/s_ilogbl.S (__ilogbl): Likewise.
* sysdeps/ieee754/dbl-64/s_ilogb.c (__ilogb): Likewise.
* sysdeps/ieee754/flt-32/s_ilogbf.c (__ilogbf): Likewise.
* sysdeps/ieee754/ldbl-128/s_ilogbl.c (__ilogbl): Likewise.
* sysdeps/ieee754/ldbl-96/s_ilogbl.c (__ilogbl): Likewise.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* sysdeps/generic/w_coshl.c (__coshl): Test if finite argument
gave non-finite result instead of using constant in generic
version.
* sysdeps/generic/w_coshf.c (__coshf): Likewise.
* sysdeps/generic/w_cosh.c (__cosh): Likewise.
* sysdeps/generic/w_exp10.c (o_threshold, u_threshold): Remove.
(__exp10): Test if finite argument gave non-finite result.
* sysdeps/generic/w_exp10f.c (o_threshold, u_threshold, __exp10f):
Likewise.
* sysdeps/generic/w_exp10l.c (o_threshold, u_threshold, __exp10l):
Likewise.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* sysdeps/ieee754/ldbl-96/e_coshl.c (__ieee754_coshl): Fix
overflow threshold constant (log(LDBL_MAX)+M_LN2l).
2001-05-29 Bruno Haible <haible@clisp.cons.org>
* locale/programs/ld-ctype.c (idx_table): New struct type.
(idx_table_init, idx_table_get, idx_table_add): New functions.
(MAX_CHARNAMES_IDX): Remove macro.
(locale_ctype_t): Change type of charnames_idx field.
(ctype_startup): Change initialization of charnames_idx field.
(find_idx): Use idx_table_get and idx_table_add for speed.
* locale/programs/charmap.c (charmap_new_char): Fix ucs4 value
computation of characters in a range.
2001-05-29 Bruno Haible <haible@clisp.cons.org>
* iconvdata/gb18030.c (__fourbyte_to_ucs1): Add mappings for <U03F4>,
<U03F5>.
(__ucs_to_gb18030_tab1): Likewise.
(BODY for FROM_LOOP): Add mapping for <U00010000>..<U0010FFFF>.
(BODY for TO_LOOP): Likewise.
* iconvdata/tst-table-charmap.sh: Update for charmaps containing
<U00xxxxxx> syntax.
* iconvdata/tst-table-from.c (bmp_only): New variable.
(utf8_decode): If bmp_only, don't return characters outside Unicode
plane 0.
(main): When testing UTF-8 or GB18030, set bmp_only to 1. Don't print
a conversion line if utf8_decode returns NULL.
* iconvdata/tst-table-to.c (main): When testing encodings other than
UTF-8 and GB18030, loop upto U+30000 instead of U+10000. Use UTF-8
instead of UCS-2 as input.
* iconvdata/tst-table.sh: For GB18030, use only the part < 0x10000
of the charmap.
2001-05-29 Bruno Haible <haible@clisp.cons.org>
* iconvdata/cns11643l1.c: Update to Unicode 3.1.
(__cns11643l1_to_ucs4_tab): Regenerated.
(__cns11643l1_from_ucs4_tab12): Regenerated.
* iconvdata/cns11643.c: Update to Unicode 3.1.
(__cns11643l14_to_ucs4_tab): Remove array.
(__cns11643l3_to_ucs4_tab, __cns11643l4_to_ucs4_tab,
__cns11643l5_to_ucs4_tab, __cns11643l6_to_ucs4_tab,
__cns11643l7_to_ucs4_tab, __cns11643l15_to_ucs4_tab): New arrays.
(__cns11643_from_ucs4p0_tab): Renamed from __cns11643_from_ucs4_tab.
(__cns11643_from_ucs4p2_tab): New array.
* iconvdata/cns11643.h (__cns11643l14_to_ucs4_tab): Remove declaration.
(__cns11643l3_to_ucs4_tab, __cns11643l4_to_ucs4_tab,
__cns11643l5_to_ucs4_tab, __cns11643l6_to_ucs4_tab,
__cns11643l7_to_ucs4_tab, __cns11643l15_to_ucs4_tab): New declarations.
(cns11643_to_ucs4): Treat planes 3, 4, 5, 6, 7, 15 instead of 14.
(__cns11643_from_ucs4_tab): Remove declaration.
(__cns11643_from_ucs4p0_tab, __cns11643_from_ucs4p2_tab): New
declarations.
(ucs4_to_cns11643): Update for new arrays. Treat U+3400..U+4DFF and
U+20000..U+2A6D6.
* iconvdata/cns11643l2.h (__cns11643_from_ucs4_tab): Remove
declaration.
(__cns11643_from_ucs4p0_tab): New declaration.
(ucs4_to_cns11643l2): Update for new arrays.
* iconvdata/iso-2022-cn-ext.c (BODY for FROM_LOOP): Handle planes
3 to 7.
(BODY for TO_LOOP): Handle planes 3 to 7, instead of plane 14.
* iconvdata/EUC-TW.irreversible: New file.
* iconvdata/tst-table.sh: Use it.
* iconvdata/Makefile (distribute): Add CP1255.irreversible,
CP1258.irreversible, EUC-TW.irreversible.
2001-05-29 Bruno Haible <haible@clisp.cons.org>
* locale/C-translit.h.in: Add transliterations for new Unicode 3.1
mathematical symbols.
2001-06-06 12:55:46 +00:00
|
|
|
extern float __ieee754_log2f (float);
|
1999-10-09 21:56:43 +00:00
|
|
|
extern float __ieee754_sinhf (float);
|
|
|
|
extern float __ieee754_hypotf (float,float);
|
|
|
|
extern float __ieee754_j0f (float);
|
|
|
|
extern float __ieee754_j1f (float);
|
|
|
|
extern float __ieee754_y0f (float);
|
|
|
|
extern float __ieee754_y1f (float);
|
|
|
|
extern float __ieee754_jnf (int,float);
|
|
|
|
extern float __ieee754_ynf (int,float);
|
|
|
|
extern float __ieee754_remainderf (float,float);
|
|
|
|
extern int32_t __ieee754_rem_pio2f (float,float*);
|
|
|
|
extern float __ieee754_scalbf (float,float);
|
2012-04-11 19:30:13 +00:00
|
|
|
extern int __ieee754_ilogbf (float);
|
1996-03-05 21:41:30 +00:00
|
|
|
|
2001-05-12 14:32:12 +00:00
|
|
|
|
1996-03-05 21:41:30 +00:00
|
|
|
/* float versions of fdlibm kernel functions */
|
1999-10-09 21:56:43 +00:00
|
|
|
extern float __kernel_sinf (float,float,int);
|
|
|
|
extern float __kernel_cosf (float,float);
|
|
|
|
extern float __kernel_tanf (float,float,int);
|
|
|
|
extern int __kernel_rem_pio2f (float*,float*,int,int,int, const int32_t*);
|
1996-03-05 21:41:30 +00:00
|
|
|
|
2003-08-28 00:14:28 +00:00
|
|
|
/* internal functions. */
|
|
|
|
extern float __copysignf (float x, float __y);
|
|
|
|
|
* math/math_private.h (__copysign): Define as builtin for gcc 4. (__copysignf, __copysignl): Likewise. * sysdeps/alpha/fpu/bits/mathinline.h (copysign): Don't define for gcc 4.0. (copysignf, copysignl, fabsf, fabs): Likewise. (__copysign, __copysignf, __copysignl): Remove. (__fabs, __fabsf): Remove.
2005-01-07 Richard Henderson <rth@redhat.com>
* math/math_private.h (__copysign): Define as builtin for gcc 4.
(__copysignf, __copysignl): Likewise.
* sysdeps/alpha/fpu/bits/mathinline.h (copysign): Don't define
for gcc 4.0.
(copysignf, copysignl, fabsf, fabs): Likewise.
(__copysign, __copysignf, __copysignl): Remove.
(__fabs, __fabsf): Remove.
2005-02-08 04:37:48 +00:00
|
|
|
extern inline float __copysignf (float x, float y)
|
|
|
|
{ return __builtin_copysignf (x, y); }
|
Thu May 30 11:24:05 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* po/header.pot: Replace with exact boilerplate pinard dictates.
* sysdeps/i386/strtok.S (Lillegal_argument): Remove this code to set
errno and the check that jumped to it.
* sysdeps/mach/hurd/Makefile (errnos.d): Use $(sed-remove-objpfx).
Thu May 30 03:21:57 1996 Ulrich Drepper <drepper@cygnus.com>
* FAQ: Document need of gperf program for developers.
* elf/elf.h: Fix typos in comments.
* libio/stdio.h [!__STRICT_ANSI__ || _POSIX_SOURCE]: Add
prototypes for `ctermid' and `cuserid'.
* locale/programs/locale.c: Switch to user selected locale
before printing variables.
* math/Makefile [$(long-double-fcts)==yes]: Define long-m-routines
and long-c-routines. Only if the `long double' data type is
available we need to compile the functions.
(libm-routines): Add $(long-m-routines).
(routines): Remove isinfl, isnanl. Use new file s_isinfl and
s_isnanl instead if `long double' is available.
* math/math.h: Include <mathcalls.h> again to define `long double'
functions.
* math/math_private.h: Define data types, prototypes and access
macros for `long double'.
* stdlib/stdlib.h: Add prototypes for `strtoll' and `strtoull'.
[GCC2 && OPTIMIZE]: Define strto{,u}ll as inline function which
calls __strto{,u}q_internal.
* stdlib/strfmon.c: Replace PTR by `void *'.
* stdlib/strtoq.c: Define strtoll as weak alias.
* stdlib/strtouq.c: Define strtoull as weak alias.
* string/tester.c: Correct `strsep' test.
* sysdeps/generic/strsep.c: Make compatible with BSD version.
Trailing characters of skip set are not skipped. In this case
empty tokens are returned.
* sysdeps/i386/isinfl.c, sysdeps/i386/isnanl.c,
sysdeps/ieee754/isinf.c, sysdeps/ieee754/isinfl.c,
sysdeps/ieee754/isnan.c, sysdeps/ieee754/isnanl.c: Removed. We
now use the versions part of libm.
* sysdeps/i386/strsep.S: Removed. Generic C version is of
similar speed.
* sysdeps/i386/strtok.S: Remove support for `strsep'.
* sysdeps/libm-i387/e_acosl.S, sysdeps/libm-i387/s_ceill.S,
sysdeps/libm-i387/s_copysignl.S, sysdeps/libm-i387/s_finitel.S,
sysdeps/libm-i387/s_floorl.S, sysdeps/libm-i387/s_isinfl.c,
sysdeps/libm-i387/s_isnanl.c, sysdeps/libm-i387/s_nextafterl.c,
sysdeps/libm-i387/s_rintl.S, sysdeps/libm-i387/s_significandl.S:
New i387 specific math functions implementing `long double'
versions.
* sysdeps/libm-ieee754/s_ceill.c,
sysdeps/libm-ieee754/s_copysignl.c,
sysdeps/libm-ieee754/s_fabsl.c, sysdeps/libm-ieee754/s_finitel.c,
sysdeps/libm-ieee754/s_floorl.c, sysdeps/libm-ieee754/s_isinfl.c,
sysdeps/libm-ieee754/s_isnanl.c,
sysdeps/libm-ieee754/s_nextafterl.c,
sysdeps/libm-ieee754/s_rintl.c, sysdeps/libm-ieee754/s_scalbnl.c,
sysdeps/libm-ieee754/s_significandl.c: New generic `long double'
versions of libm functions.
* sysdeps/libm-i387/e_exp.S: Add a few comments to explain the
Intel FPU nonsense.
* sysdeps/libm-i387/s_ceil.S, sysdeps/libm-i387/s_ceilf.S,
sysdeps/libm-i387/s_floor.S, sysdeps/libm-i387/s_floorf.S: Correct
handling of local variables. The old version created a stack
frame but stored the values outside.
* sysdeps/libm-ieee754/s_isinf.c, sysdeps/libm-ieee754/s_isnan.c
[!NO_LONG_DOUBLE]: Define alias with `long double' versions name.
* login/pututline_r.c: Include sys/stat.h. Fix typos.
according to currently used locale for category LC_CTYPE by
inet_nsap_ntoa. Now in <arpa/inet.h>.
_IO_dup2 to contain complete parameter list.
1996-05-30 16:12:42 +00:00
|
|
|
|
|
|
|
/* ieee style elementary long double functions */
|
1999-10-09 21:56:43 +00:00
|
|
|
extern long double __ieee754_sqrtl (long double);
|
|
|
|
extern long double __ieee754_acosl (long double);
|
|
|
|
extern long double __ieee754_acoshl (long double);
|
|
|
|
extern long double __ieee754_logl (long double);
|
|
|
|
extern long double __ieee754_atanhl (long double);
|
|
|
|
extern long double __ieee754_asinl (long double);
|
|
|
|
extern long double __ieee754_atan2l (long double,long double);
|
|
|
|
extern long double __ieee754_expl (long double);
|
|
|
|
extern long double __ieee754_exp2l (long double);
|
|
|
|
extern long double __ieee754_exp10l (long double);
|
|
|
|
extern long double __ieee754_coshl (long double);
|
|
|
|
extern long double __ieee754_fmodl (long double,long double);
|
|
|
|
extern long double __ieee754_powl (long double,long double);
|
|
|
|
extern long double __ieee754_lgammal_r (long double,int *);
|
|
|
|
extern long double __ieee754_gammal_r (long double,int *);
|
|
|
|
extern long double __ieee754_lgammal (long double);
|
|
|
|
extern long double __ieee754_gammal (long double);
|
|
|
|
extern long double __ieee754_log10l (long double);
|
Update.
2001-06-04 Bruno Haible <haible@clisp.cons.org>
* iconv/loop.c (UNICODE_TAG_HANDLER): New macro.
* iconv/gconv_simple.c (__gconv_transform_internal_ascii): Invoke
UNICODE_TAG_HANDLER.
(__gconv_transform_internal_ucs2): Likewise.
(__gconv_transform_internal_ucs2reverse): Likewise.
* iconvdata/8bit-gap.c (BODY for TO_LOOP): Invoke UNICODE_TAG_HANDLER.
* iconvdata/8bit-generic.c (BODY for TO_LOOP): Likewise.
* iconvdata/ansi_x3.110.c (BODY for TO_LOOP): Likewise.
* iconvdata/big5.c (BODY for TO_LOOP): Likewise.
* iconvdata/big5hkscs.c (BODY for TO_LOOP): Likewise.
* iconvdata/cp1255.c (BODY for TO_LOOP): Likewise.
* iconvdata/cp1258.c (BODY for TO_LOOP): Likewise.
* iconvdata/euc-cn.c (BODY for TO_LOOP): Likewise.
* iconvdata/euc-jp.c (BODY for TO_LOOP): Likewise.
* iconvdata/euc-kr.c (BODY for TO_LOOP): Likewise.
* iconvdata/euc-tw.c (BODY for TO_LOOP): Likewise.
* iconvdata/gbk.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm930.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm932.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm933.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm935.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm937.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm939.c (BODY for TO_LOOP): Likewise.
* iconvdata/ibm943.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso646.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso8859-1.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso_6937.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso_6937-2.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso-2022-cn.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso-2022-cn-ext.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso-2022-kr.c (BODY for TO_LOOP): Likewise.
* iconvdata/johab.c (BODY for TO_LOOP): Likewise.
* iconvdata/sjis.c (BODY for TO_LOOP): Likewise.
* iconvdata/t.61.c (BODY for TO_LOOP): Likewise.
* iconvdata/uhc.c (BODY for TO_LOOP): Likewise.
* iconvdata/unicode.c (BODY for TO_LOOP): Likewise.
* iconvdata/iso-2022-jp.c (TAG_none, TAG_language, TAG_language_j,
TAG_language_ja, TAG_language_k, TAG_language_ko, TAG_language_z,
TAG_language_zh, CURRENT_TAG_MASK): New enum values.
(EMIT_SHIFT_TO_INIT): Don't emit an escape sequence if ASCII_set
is already selected but set2 or tag are set.
(conversion): New enum type.
(cvlist_t): New type.
(CVLIST, CVLIST_FIRST, CVLIST_REST): New macros.
(conversion_lists): New array.
(BODY for TO_LOOP): Keep track of Unicode 3.1 language tag. If "ja",
prefer conversion to Japanese character sets. If "zh", prefer
conversion to GB2312. If "ko", prefer conversion to KSC5601. Small
optimizations.
(INIT_PARAMS): Add tag.
(UPDATE_PARAMS): Add tag.
2001-06-04 Bruno Haible <haible@clisp.cons.org>
* locale/programs/locfile.c (write_locale_data): Before creat(),
unlink the file, to avoid crashing the processes that mmap it. Change
a double slash to a single slash. Free fname in case of error return.
2001-06-02 Jakub Jelinek <jakub@redhat.com>
* sysdeps/i386/fpu/s_frexpl.S (__frexpl): Mostly revert 2000-12-03
changes, do the special handling for denormal numbers, not for
normalized numbers (patch by <trevin@xmission.com>).
* math/test-misc.c (main): Test frexpl with denormal arguments.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* math/libm-test.inc (llround_test): Add two new llround tests.
* sysdeps/ieee754/ldbl-96/s_llroundl.c (__llroundl): Don't allow
overflow when rounding away from zero.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* math/Makefile (libm-calls): Add e_log2, w_log2, remove s_log2.
* math/math_private.h (__ieee754_log2, __ieee754_log2f,
__ieee754_log2l): New prototypes.
* sysdeps/generic/w_log2.c: New file.
* sysdeps/generic/w_log2f.c: New file.
* sysdeps/generic/w_log2l.c: New file.
* sysdeps/generic/s_log2l.c: Move...
* sysdeps/generic/e_log2l.c: ...to here. Rename to __ieee754_log2l.
* sysdeps/ieee754/k_standard.c (__kernel_standard): Handle log2(0)
and log2(x < 0).
* sysdeps/i386/fpu/s_log2.S: Move...
* sysdeps/i386/fpu/e_log2.S: ...to here. Rename to __ieee754_log2.
* sysdeps/i386/fpu/s_log2f.S: Move...
* sysdeps/i386/fpu/e_log2f.S: ...to here. Rename to __ieee754_log2f.
* sysdeps/i386/fpu/s_log2l.S: Move...
* sysdeps/i386/fpu/e_log2l.S: ...to here. Rename to __ieee754_log2l.
* sysdeps/m68k/fpu/s_log2.S: Move...
* sysdeps/m68k/fpu/e_log2.S: ...to here. Rename to __ieee754_log2.
* sysdeps/m68k/fpu/s_log2f.S: Move...
* sysdeps/m68k/fpu/e_log2f.S: ...to here. Rename to __ieee754_log2f.
* sysdeps/m68k/fpu/s_log2l.S: Move...
* sysdeps/m68k/fpu/e_log2l.S: ...to here. Rename to __ieee754_log2l.
* sysdeps/ieee754/dbl-64/s_log2.c: Move...
* sysdeps/ieee754/dbl-64/e_log2.c: ...to here. Rename to
__ieee754_log2.
* sysdeps/ieee754/flt-32/s_log2f.c: Move...
* sysdeps/ieee754/flt-32/e_log2f.c: ...to here. Rename to
__ieee754_log2f.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* sysdeps/generic/w_exp2.c (u_threshold): Lower threshold so that
even arguments which result in denormalized exp2 are accepted.
(__exp2): Arguments equal to u_threshold already result into
underflow.
* sysdeps/generic/w_exp2f.c (u_threshold, __exp2f): Likewise.
* sysdeps/generic/w_exp2l.c (u_threshold, __exp2l): Likewise.
* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Lomark was too
low, with corrected lowmark use greaterequal, not greater.
* sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Likewise.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* math/libm-test.inc (ilogb_test): Test that ilogb(+-Inf) == INT_MAX.
* sysdeps/i386/fpu/s_ilogb.S (__ilogb): Return INT_MAX for +-Inf.
* sysdeps/i386/fpu/s_ilogbf.S (__ilogbf): Likewise.
* sysdeps/i386/fpu/s_ilogbl.S (__ilogbl): Likewise.
* sysdeps/ieee754/dbl-64/s_ilogb.c (__ilogb): Likewise.
* sysdeps/ieee754/flt-32/s_ilogbf.c (__ilogbf): Likewise.
* sysdeps/ieee754/ldbl-128/s_ilogbl.c (__ilogbl): Likewise.
* sysdeps/ieee754/ldbl-96/s_ilogbl.c (__ilogbl): Likewise.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* sysdeps/generic/w_coshl.c (__coshl): Test if finite argument
gave non-finite result instead of using constant in generic
version.
* sysdeps/generic/w_coshf.c (__coshf): Likewise.
* sysdeps/generic/w_cosh.c (__cosh): Likewise.
* sysdeps/generic/w_exp10.c (o_threshold, u_threshold): Remove.
(__exp10): Test if finite argument gave non-finite result.
* sysdeps/generic/w_exp10f.c (o_threshold, u_threshold, __exp10f):
Likewise.
* sysdeps/generic/w_exp10l.c (o_threshold, u_threshold, __exp10l):
Likewise.
2001-06-04 Jakub Jelinek <jakub@redhat.com>
* sysdeps/ieee754/ldbl-96/e_coshl.c (__ieee754_coshl): Fix
overflow threshold constant (log(LDBL_MAX)+M_LN2l).
2001-05-29 Bruno Haible <haible@clisp.cons.org>
* locale/programs/ld-ctype.c (idx_table): New struct type.
(idx_table_init, idx_table_get, idx_table_add): New functions.
(MAX_CHARNAMES_IDX): Remove macro.
(locale_ctype_t): Change type of charnames_idx field.
(ctype_startup): Change initialization of charnames_idx field.
(find_idx): Use idx_table_get and idx_table_add for speed.
* locale/programs/charmap.c (charmap_new_char): Fix ucs4 value
computation of characters in a range.
2001-05-29 Bruno Haible <haible@clisp.cons.org>
* iconvdata/gb18030.c (__fourbyte_to_ucs1): Add mappings for <U03F4>,
<U03F5>.
(__ucs_to_gb18030_tab1): Likewise.
(BODY for FROM_LOOP): Add mapping for <U00010000>..<U0010FFFF>.
(BODY for TO_LOOP): Likewise.
* iconvdata/tst-table-charmap.sh: Update for charmaps containing
<U00xxxxxx> syntax.
* iconvdata/tst-table-from.c (bmp_only): New variable.
(utf8_decode): If bmp_only, don't return characters outside Unicode
plane 0.
(main): When testing UTF-8 or GB18030, set bmp_only to 1. Don't print
a conversion line if utf8_decode returns NULL.
* iconvdata/tst-table-to.c (main): When testing encodings other than
UTF-8 and GB18030, loop upto U+30000 instead of U+10000. Use UTF-8
instead of UCS-2 as input.
* iconvdata/tst-table.sh: For GB18030, use only the part < 0x10000
of the charmap.
2001-05-29 Bruno Haible <haible@clisp.cons.org>
* iconvdata/cns11643l1.c: Update to Unicode 3.1.
(__cns11643l1_to_ucs4_tab): Regenerated.
(__cns11643l1_from_ucs4_tab12): Regenerated.
* iconvdata/cns11643.c: Update to Unicode 3.1.
(__cns11643l14_to_ucs4_tab): Remove array.
(__cns11643l3_to_ucs4_tab, __cns11643l4_to_ucs4_tab,
__cns11643l5_to_ucs4_tab, __cns11643l6_to_ucs4_tab,
__cns11643l7_to_ucs4_tab, __cns11643l15_to_ucs4_tab): New arrays.
(__cns11643_from_ucs4p0_tab): Renamed from __cns11643_from_ucs4_tab.
(__cns11643_from_ucs4p2_tab): New array.
* iconvdata/cns11643.h (__cns11643l14_to_ucs4_tab): Remove declaration.
(__cns11643l3_to_ucs4_tab, __cns11643l4_to_ucs4_tab,
__cns11643l5_to_ucs4_tab, __cns11643l6_to_ucs4_tab,
__cns11643l7_to_ucs4_tab, __cns11643l15_to_ucs4_tab): New declarations.
(cns11643_to_ucs4): Treat planes 3, 4, 5, 6, 7, 15 instead of 14.
(__cns11643_from_ucs4_tab): Remove declaration.
(__cns11643_from_ucs4p0_tab, __cns11643_from_ucs4p2_tab): New
declarations.
(ucs4_to_cns11643): Update for new arrays. Treat U+3400..U+4DFF and
U+20000..U+2A6D6.
* iconvdata/cns11643l2.h (__cns11643_from_ucs4_tab): Remove
declaration.
(__cns11643_from_ucs4p0_tab): New declaration.
(ucs4_to_cns11643l2): Update for new arrays.
* iconvdata/iso-2022-cn-ext.c (BODY for FROM_LOOP): Handle planes
3 to 7.
(BODY for TO_LOOP): Handle planes 3 to 7, instead of plane 14.
* iconvdata/EUC-TW.irreversible: New file.
* iconvdata/tst-table.sh: Use it.
* iconvdata/Makefile (distribute): Add CP1255.irreversible,
CP1258.irreversible, EUC-TW.irreversible.
2001-05-29 Bruno Haible <haible@clisp.cons.org>
* locale/C-translit.h.in: Add transliterations for new Unicode 3.1
mathematical symbols.
2001-06-06 12:55:46 +00:00
|
|
|
extern long double __ieee754_log2l (long double);
|
1999-10-09 21:56:43 +00:00
|
|
|
extern long double __ieee754_sinhl (long double);
|
|
|
|
extern long double __ieee754_hypotl (long double,long double);
|
|
|
|
extern long double __ieee754_j0l (long double);
|
|
|
|
extern long double __ieee754_j1l (long double);
|
|
|
|
extern long double __ieee754_y0l (long double);
|
|
|
|
extern long double __ieee754_y1l (long double);
|
|
|
|
extern long double __ieee754_jnl (int,long double);
|
|
|
|
extern long double __ieee754_ynl (int,long double);
|
|
|
|
extern long double __ieee754_remainderl (long double,long double);
|
|
|
|
extern int __ieee754_rem_pio2l (long double,long double*);
|
|
|
|
extern long double __ieee754_scalbl (long double,long double);
|
2012-04-11 19:30:13 +00:00
|
|
|
extern int __ieee754_ilogbl (long double);
|
Thu May 30 11:24:05 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* po/header.pot: Replace with exact boilerplate pinard dictates.
* sysdeps/i386/strtok.S (Lillegal_argument): Remove this code to set
errno and the check that jumped to it.
* sysdeps/mach/hurd/Makefile (errnos.d): Use $(sed-remove-objpfx).
Thu May 30 03:21:57 1996 Ulrich Drepper <drepper@cygnus.com>
* FAQ: Document need of gperf program for developers.
* elf/elf.h: Fix typos in comments.
* libio/stdio.h [!__STRICT_ANSI__ || _POSIX_SOURCE]: Add
prototypes for `ctermid' and `cuserid'.
* locale/programs/locale.c: Switch to user selected locale
before printing variables.
* math/Makefile [$(long-double-fcts)==yes]: Define long-m-routines
and long-c-routines. Only if the `long double' data type is
available we need to compile the functions.
(libm-routines): Add $(long-m-routines).
(routines): Remove isinfl, isnanl. Use new file s_isinfl and
s_isnanl instead if `long double' is available.
* math/math.h: Include <mathcalls.h> again to define `long double'
functions.
* math/math_private.h: Define data types, prototypes and access
macros for `long double'.
* stdlib/stdlib.h: Add prototypes for `strtoll' and `strtoull'.
[GCC2 && OPTIMIZE]: Define strto{,u}ll as inline function which
calls __strto{,u}q_internal.
* stdlib/strfmon.c: Replace PTR by `void *'.
* stdlib/strtoq.c: Define strtoll as weak alias.
* stdlib/strtouq.c: Define strtoull as weak alias.
* string/tester.c: Correct `strsep' test.
* sysdeps/generic/strsep.c: Make compatible with BSD version.
Trailing characters of skip set are not skipped. In this case
empty tokens are returned.
* sysdeps/i386/isinfl.c, sysdeps/i386/isnanl.c,
sysdeps/ieee754/isinf.c, sysdeps/ieee754/isinfl.c,
sysdeps/ieee754/isnan.c, sysdeps/ieee754/isnanl.c: Removed. We
now use the versions part of libm.
* sysdeps/i386/strsep.S: Removed. Generic C version is of
similar speed.
* sysdeps/i386/strtok.S: Remove support for `strsep'.
* sysdeps/libm-i387/e_acosl.S, sysdeps/libm-i387/s_ceill.S,
sysdeps/libm-i387/s_copysignl.S, sysdeps/libm-i387/s_finitel.S,
sysdeps/libm-i387/s_floorl.S, sysdeps/libm-i387/s_isinfl.c,
sysdeps/libm-i387/s_isnanl.c, sysdeps/libm-i387/s_nextafterl.c,
sysdeps/libm-i387/s_rintl.S, sysdeps/libm-i387/s_significandl.S:
New i387 specific math functions implementing `long double'
versions.
* sysdeps/libm-ieee754/s_ceill.c,
sysdeps/libm-ieee754/s_copysignl.c,
sysdeps/libm-ieee754/s_fabsl.c, sysdeps/libm-ieee754/s_finitel.c,
sysdeps/libm-ieee754/s_floorl.c, sysdeps/libm-ieee754/s_isinfl.c,
sysdeps/libm-ieee754/s_isnanl.c,
sysdeps/libm-ieee754/s_nextafterl.c,
sysdeps/libm-ieee754/s_rintl.c, sysdeps/libm-ieee754/s_scalbnl.c,
sysdeps/libm-ieee754/s_significandl.c: New generic `long double'
versions of libm functions.
* sysdeps/libm-i387/e_exp.S: Add a few comments to explain the
Intel FPU nonsense.
* sysdeps/libm-i387/s_ceil.S, sysdeps/libm-i387/s_ceilf.S,
sysdeps/libm-i387/s_floor.S, sysdeps/libm-i387/s_floorf.S: Correct
handling of local variables. The old version created a stack
frame but stored the values outside.
* sysdeps/libm-ieee754/s_isinf.c, sysdeps/libm-ieee754/s_isnan.c
[!NO_LONG_DOUBLE]: Define alias with `long double' versions name.
* login/pututline_r.c: Include sys/stat.h. Fix typos.
according to currently used locale for category LC_CTYPE by
inet_nsap_ntoa. Now in <arpa/inet.h>.
_IO_dup2 to contain complete parameter list.
1996-05-30 16:12:42 +00:00
|
|
|
|
|
|
|
/* long double versions of fdlibm kernel functions */
|
1999-10-09 21:56:43 +00:00
|
|
|
extern long double __kernel_sinl (long double,long double,int);
|
|
|
|
extern long double __kernel_cosl (long double,long double);
|
|
|
|
extern long double __kernel_tanl (long double,long double,int);
|
|
|
|
extern void __kernel_sincosl (long double,long double,
|
|
|
|
long double *,long double *, int);
|
|
|
|
extern int __kernel_rem_pio2l (long double*,long double*,int,int,
|
|
|
|
int,const int*);
|
Thu May 30 11:24:05 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* po/header.pot: Replace with exact boilerplate pinard dictates.
* sysdeps/i386/strtok.S (Lillegal_argument): Remove this code to set
errno and the check that jumped to it.
* sysdeps/mach/hurd/Makefile (errnos.d): Use $(sed-remove-objpfx).
Thu May 30 03:21:57 1996 Ulrich Drepper <drepper@cygnus.com>
* FAQ: Document need of gperf program for developers.
* elf/elf.h: Fix typos in comments.
* libio/stdio.h [!__STRICT_ANSI__ || _POSIX_SOURCE]: Add
prototypes for `ctermid' and `cuserid'.
* locale/programs/locale.c: Switch to user selected locale
before printing variables.
* math/Makefile [$(long-double-fcts)==yes]: Define long-m-routines
and long-c-routines. Only if the `long double' data type is
available we need to compile the functions.
(libm-routines): Add $(long-m-routines).
(routines): Remove isinfl, isnanl. Use new file s_isinfl and
s_isnanl instead if `long double' is available.
* math/math.h: Include <mathcalls.h> again to define `long double'
functions.
* math/math_private.h: Define data types, prototypes and access
macros for `long double'.
* stdlib/stdlib.h: Add prototypes for `strtoll' and `strtoull'.
[GCC2 && OPTIMIZE]: Define strto{,u}ll as inline function which
calls __strto{,u}q_internal.
* stdlib/strfmon.c: Replace PTR by `void *'.
* stdlib/strtoq.c: Define strtoll as weak alias.
* stdlib/strtouq.c: Define strtoull as weak alias.
* string/tester.c: Correct `strsep' test.
* sysdeps/generic/strsep.c: Make compatible with BSD version.
Trailing characters of skip set are not skipped. In this case
empty tokens are returned.
* sysdeps/i386/isinfl.c, sysdeps/i386/isnanl.c,
sysdeps/ieee754/isinf.c, sysdeps/ieee754/isinfl.c,
sysdeps/ieee754/isnan.c, sysdeps/ieee754/isnanl.c: Removed. We
now use the versions part of libm.
* sysdeps/i386/strsep.S: Removed. Generic C version is of
similar speed.
* sysdeps/i386/strtok.S: Remove support for `strsep'.
* sysdeps/libm-i387/e_acosl.S, sysdeps/libm-i387/s_ceill.S,
sysdeps/libm-i387/s_copysignl.S, sysdeps/libm-i387/s_finitel.S,
sysdeps/libm-i387/s_floorl.S, sysdeps/libm-i387/s_isinfl.c,
sysdeps/libm-i387/s_isnanl.c, sysdeps/libm-i387/s_nextafterl.c,
sysdeps/libm-i387/s_rintl.S, sysdeps/libm-i387/s_significandl.S:
New i387 specific math functions implementing `long double'
versions.
* sysdeps/libm-ieee754/s_ceill.c,
sysdeps/libm-ieee754/s_copysignl.c,
sysdeps/libm-ieee754/s_fabsl.c, sysdeps/libm-ieee754/s_finitel.c,
sysdeps/libm-ieee754/s_floorl.c, sysdeps/libm-ieee754/s_isinfl.c,
sysdeps/libm-ieee754/s_isnanl.c,
sysdeps/libm-ieee754/s_nextafterl.c,
sysdeps/libm-ieee754/s_rintl.c, sysdeps/libm-ieee754/s_scalbnl.c,
sysdeps/libm-ieee754/s_significandl.c: New generic `long double'
versions of libm functions.
* sysdeps/libm-i387/e_exp.S: Add a few comments to explain the
Intel FPU nonsense.
* sysdeps/libm-i387/s_ceil.S, sysdeps/libm-i387/s_ceilf.S,
sysdeps/libm-i387/s_floor.S, sysdeps/libm-i387/s_floorf.S: Correct
handling of local variables. The old version created a stack
frame but stored the values outside.
* sysdeps/libm-ieee754/s_isinf.c, sysdeps/libm-ieee754/s_isnan.c
[!NO_LONG_DOUBLE]: Define alias with `long double' versions name.
* login/pututline_r.c: Include sys/stat.h. Fix typos.
according to currently used locale for category LC_CTYPE by
inet_nsap_ntoa. Now in <arpa/inet.h>.
_IO_dup2 to contain complete parameter list.
1996-05-30 16:12:42 +00:00
|
|
|
|
2000-09-27 07:01:14 +00:00
|
|
|
#ifndef NO_LONG_DOUBLE
|
2000-09-26 19:13:37 +00:00
|
|
|
/* prototypes required to compile the ldbl-96 support without warnings */
|
|
|
|
extern int __finitel (long double);
|
2000-09-27 07:01:14 +00:00
|
|
|
extern int __ilogbl (long double);
|
2000-09-26 19:13:37 +00:00
|
|
|
extern int __isinfl (long double);
|
2000-09-27 07:01:14 +00:00
|
|
|
extern int __isnanl (long double);
|
2000-09-26 19:13:37 +00:00
|
|
|
extern long double __atanl (long double);
|
2000-09-27 07:01:14 +00:00
|
|
|
extern long double __copysignl (long double, long double);
|
2000-09-26 19:13:37 +00:00
|
|
|
extern long double __expm1l (long double);
|
2000-09-27 07:01:14 +00:00
|
|
|
extern long double __floorl (long double);
|
|
|
|
extern long double __frexpl (long double, int *);
|
|
|
|
extern long double __ldexpl (long double, int);
|
2000-09-26 19:13:37 +00:00
|
|
|
extern long double __log1pl (long double);
|
|
|
|
extern long double __nanl (const char *);
|
2000-09-27 07:01:14 +00:00
|
|
|
extern long double __rintl (long double);
|
2000-09-26 19:13:37 +00:00
|
|
|
extern long double __scalbnl (long double, int);
|
2000-09-27 07:01:14 +00:00
|
|
|
extern long double __sqrtl (long double x);
|
|
|
|
extern long double fabsl (long double x);
|
2000-09-26 19:13:37 +00:00
|
|
|
extern void __sincosl (long double, long double *, long double *);
|
2001-09-22 13:44:03 +00:00
|
|
|
extern long double __logbl (long double x);
|
|
|
|
extern long double __significandl (long double x);
|
* math/math_private.h (__copysign): Define as builtin for gcc 4. (__copysignf, __copysignl): Likewise. * sysdeps/alpha/fpu/bits/mathinline.h (copysign): Don't define for gcc 4.0. (copysignf, copysignl, fabsf, fabs): Likewise. (__copysign, __copysignf, __copysignl): Remove. (__fabs, __fabsf): Remove.
2005-01-07 Richard Henderson <rth@redhat.com>
* math/math_private.h (__copysign): Define as builtin for gcc 4.
(__copysignf, __copysignl): Likewise.
* sysdeps/alpha/fpu/bits/mathinline.h (copysign): Don't define
for gcc 4.0.
(copysignf, copysignl, fabsf, fabs): Likewise.
(__copysign, __copysignf, __copysignl): Remove.
(__fabs, __fabsf): Remove.
2005-02-08 04:37:48 +00:00
|
|
|
|
|
|
|
extern inline long double __copysignl (long double x, long double y)
|
|
|
|
{ return __builtin_copysignl (x, y); }
|
|
|
|
|
2000-09-27 07:01:14 +00:00
|
|
|
#endif
|
2000-09-26 19:13:37 +00:00
|
|
|
|
2001-05-12 20:15:01 +00:00
|
|
|
/* Prototypes for functions of the IBM Accurate Mathematical Library. */
|
|
|
|
extern double __exp1 (double __x, double __xx, double __error);
|
|
|
|
extern double __sin (double __x);
|
|
|
|
extern double __cos (double __x);
|
|
|
|
extern int __branred (double __x, double *__a, double *__aa);
|
|
|
|
extern void __doasin (double __x, double __dx, double __v[]);
|
|
|
|
extern void __dubsin (double __x, double __dx, double __v[]);
|
|
|
|
extern void __dubcos (double __x, double __dx, double __v[]);
|
|
|
|
extern double __halfulp (double __x, double __y);
|
|
|
|
extern double __sin32 (double __x, double __res, double __res1);
|
|
|
|
extern double __cos32 (double __x, double __res, double __res1);
|
2013-10-08 06:20:17 +00:00
|
|
|
extern double __mpsin (double __x, double __dx, bool __range_reduce);
|
|
|
|
extern double __mpcos (double __x, double __dx, bool __range_reduce);
|
2001-05-12 20:15:01 +00:00
|
|
|
extern double __slowexp (double __x);
|
|
|
|
extern double __slowpow (double __x, double __y, double __z);
|
|
|
|
extern void __docos (double __x, double __dx, double __v[]);
|
|
|
|
|
2012-09-25 19:43:49 +00:00
|
|
|
/* Return X^2 + Y^2 - 1, computed without large cancellation error.
|
|
|
|
It is given that 1 > X >= Y >= epsilon / 2, and that either X >=
|
|
|
|
0.75 or Y >= 0.5. */
|
|
|
|
extern float __x2y2m1f (float x, float y);
|
|
|
|
extern double __x2y2m1 (double x, double y);
|
|
|
|
extern long double __x2y2m1l (long double x, long double y);
|
|
|
|
|
2013-05-08 11:58:18 +00:00
|
|
|
/* Compute the product of X + X_EPS, X + X_EPS + 1, ..., X + X_EPS + N
|
|
|
|
- 1, in the form R * (1 + *EPS) where the return value R is an
|
|
|
|
approximation to the product and *EPS is set to indicate the
|
|
|
|
approximate error in the return value. X is such that all the
|
|
|
|
values X + 1, ..., X + N - 1 are exactly representable, and X_EPS /
|
|
|
|
X is small enough that factors quadratic in it can be
|
|
|
|
neglected. */
|
|
|
|
extern float __gamma_productf (float x, float x_eps, int n, float *eps);
|
|
|
|
extern double __gamma_product (double x, double x_eps, int n, double *eps);
|
|
|
|
extern long double __gamma_productl (long double x, long double x_eps,
|
|
|
|
int n, long double *eps);
|
|
|
|
|
Fix lgamma (negative) inaccuracy (bug 2542, bug 2543, bug 2558).
The existing implementations of lgamma functions (except for the ia64
versions) use the reflection formula for negative arguments. This
suffers large inaccuracy from cancellation near zeros of lgamma (near
where the gamma function is +/- 1).
This patch fixes this inaccuracy. For arguments above -2, there are
no zeros and no large cancellation, while for sufficiently large
negative arguments the zeros are so close to integers that even for
integers +/- 1ulp the log(gamma(1-x)) term dominates and cancellation
is not significant. Thus, it is only necessary to take special care
about cancellation for arguments around a limited number of zeros.
Accordingly, this patch uses precomputed tables of relevant zeros,
expressed as the sum of two floating-point values. The log of the
ratio of two sines can be computed accurately using log1p in cases
where log would lose accuracy. The log of the ratio of two gamma(1-x)
values can be computed using Stirling's approximation (the difference
between two values of that approximation to lgamma being computable
without computing the two values and then subtracting), with
appropriate adjustments (which don't reduce accuracy too much) in
cases where 1-x is too small to use Stirling's approximation directly.
In the interval from -3 to -2, using the ratios of sines and of
gamma(1-x) can still produce too much cancellation between those two
parts of the computation (and that interval is also the worst interval
for computing the ratio between gamma(1-x) values, which computation
becomes more accurate, while being less critical for the final result,
for larger 1-x). Because this can result in errors slightly above
those accepted in glibc, this interval is instead dealt with by
polynomial approximations. Separate polynomial approximations to
(|gamma(x)|-1)(x-n)/(x-x0) are used for each interval of length 1/8
from -3 to -2, where n (-3 or -2) is the nearest integer to the
1/8-interval and x0 is the zero of lgamma in the relevant half-integer
interval (-3 to -2.5 or -2.5 to -2).
Together, the two approaches are intended to give sufficient accuracy
for all negative arguments in the problem range. Outside that range,
the previous implementation continues to be used.
Tested for x86_64, x86, mips64 and powerpc. The mips64 and powerpc
testing shows up pre-existing problems for ldbl-128 and ldbl-128ibm
with large negative arguments giving spurious "invalid" exceptions
(exposed by newly added tests for cases this patch doesn't affect the
logic for); I'll address those problems separately.
[BZ #2542]
[BZ #2543]
[BZ #2558]
* sysdeps/ieee754/dbl-64/e_lgamma_r.c (__ieee754_lgamma_r): Call
__lgamma_neg for arguments from -28.0 to -2.0.
* sysdeps/ieee754/flt-32/e_lgammaf_r.c (__ieee754_lgammaf_r): Call
__lgamma_negf for arguments from -15.0 to -2.0.
* sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgammal_r):
Call __lgamma_negl for arguments from -48.0 or -50.0 to -2.0.
* sysdeps/ieee754/ldbl-96/e_lgammal_r.c (__ieee754_lgammal_r):
Call __lgamma_negl for arguments from -33.0 to -2.0.
* sysdeps/ieee754/dbl-64/lgamma_neg.c: New file.
* sysdeps/ieee754/dbl-64/lgamma_product.c: Likewise.
* sysdeps/ieee754/flt-32/lgamma_negf.c: Likewise.
* sysdeps/ieee754/flt-32/lgamma_productf.c: Likewise.
* sysdeps/ieee754/ldbl-128/lgamma_negl.c: Likewise.
* sysdeps/ieee754/ldbl-128/lgamma_productl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/lgamma_productl.c: Likewise.
* sysdeps/ieee754/ldbl-96/lgamma_negl.c: Likewise.
* sysdeps/ieee754/ldbl-96/lgamma_product.c: Likewise.
* sysdeps/ieee754/ldbl-96/lgamma_productl.c: Likewise.
* sysdeps/generic/math_private.h (__lgamma_negf): New prototype.
(__lgamma_neg): Likewise.
(__lgamma_negl): Likewise.
(__lgamma_product): Likewise.
(__lgamma_productl): Likewise.
* math/Makefile (libm-calls): Add lgamma_neg and lgamma_product.
* math/auto-libm-test-in: Add more tests of lgamma.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-09-10 22:27:58 +00:00
|
|
|
/* Compute lgamma of a negative argument X, if it is in a range
|
|
|
|
(depending on the floating-point format) for which expansion around
|
|
|
|
zeros is used, setting *SIGNGAMP accordingly. */
|
|
|
|
extern float __lgamma_negf (float x, int *signgamp);
|
|
|
|
extern double __lgamma_neg (double x, int *signgamp);
|
|
|
|
extern long double __lgamma_negl (long double x, int *signgamp);
|
|
|
|
|
|
|
|
/* Compute the product of 1 + (T / (X + X_EPS)), 1 + (T / (X + X_EPS +
|
|
|
|
1)), ..., 1 + (T / (X + X_EPS + N - 1)), minus 1. X is such that
|
|
|
|
all the values X + 1, ..., X + N - 1 are exactly representable, and
|
|
|
|
X_EPS / X is small enough that factors quadratic in it can be
|
|
|
|
neglected. */
|
|
|
|
extern double __lgamma_product (double t, double x, double x_eps, int n);
|
|
|
|
extern long double __lgamma_productl (long double t, long double x,
|
|
|
|
long double x_eps, int n);
|
|
|
|
|
2007-04-16 20:41:42 +00:00
|
|
|
#ifndef math_opt_barrier
|
2012-01-08 04:57:22 +00:00
|
|
|
# define math_opt_barrier(x) \
|
2011-10-26 09:19:35 +00:00
|
|
|
({ __typeof (x) __x = (x); __asm ("" : "+m" (__x)); __x; })
|
2012-01-08 04:57:22 +00:00
|
|
|
# define math_force_eval(x) \
|
|
|
|
({ __typeof (x) __x = (x); __asm __volatile__ ("" : : "m" (__x)); })
|
2007-04-16 20:41:42 +00:00
|
|
|
#endif
|
|
|
|
|
2015-09-18 20:00:48 +00:00
|
|
|
/* math_narrow_eval reduces its floating-point argument to the range
|
|
|
|
and precision of its semantic type. (The original evaluation may
|
|
|
|
still occur with excess range and precision, so the result may be
|
|
|
|
affected by double rounding.) */
|
|
|
|
#if FLT_EVAL_METHOD == 0
|
|
|
|
# define math_narrow_eval(x) (x)
|
|
|
|
#else
|
|
|
|
# if FLT_EVAL_METHOD == 1
|
|
|
|
# define excess_precision(type) __builtin_types_compatible_p (type, float)
|
|
|
|
# else
|
|
|
|
# define excess_precision(type) (__builtin_types_compatible_p (type, float) \
|
|
|
|
|| __builtin_types_compatible_p (type, \
|
|
|
|
double))
|
|
|
|
# endif
|
|
|
|
# define math_narrow_eval(x) \
|
|
|
|
({ \
|
|
|
|
__typeof (x) math_narrow_eval_tmp = (x); \
|
|
|
|
if (excess_precision (__typeof (math_narrow_eval_tmp))) \
|
|
|
|
__asm__ ("" : "+m" (math_narrow_eval_tmp)); \
|
|
|
|
math_narrow_eval_tmp; \
|
|
|
|
})
|
|
|
|
#endif
|
|
|
|
|
2011-10-18 13:00:46 +00:00
|
|
|
|
|
|
|
/* The standards only specify one variant of the fenv.h interfaces.
|
|
|
|
But at least for some architectures we can be more efficient if we
|
|
|
|
know what operations are going to be performed. Therefore we
|
|
|
|
define additional interfaces. By default they refer to the normal
|
|
|
|
interfaces. */
|
|
|
|
|
2012-03-09 20:51:27 +00:00
|
|
|
static __always_inline void
|
|
|
|
default_libc_feholdexcept (fenv_t *e)
|
|
|
|
{
|
2015-01-05 23:06:14 +00:00
|
|
|
(void) __feholdexcept (e);
|
2012-03-09 20:51:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef libc_feholdexcept
|
|
|
|
# define libc_feholdexcept default_libc_feholdexcept
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feholdexceptf
|
|
|
|
# define libc_feholdexceptf default_libc_feholdexcept
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feholdexceptl
|
|
|
|
# define libc_feholdexceptl default_libc_feholdexcept
|
|
|
|
#endif
|
|
|
|
|
2012-11-03 19:48:53 +00:00
|
|
|
static __always_inline void
|
|
|
|
default_libc_fesetround (int r)
|
|
|
|
{
|
2015-01-07 00:41:23 +00:00
|
|
|
(void) __fesetround (r);
|
2012-11-03 19:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef libc_fesetround
|
|
|
|
# define libc_fesetround default_libc_fesetround
|
|
|
|
#endif
|
|
|
|
#ifndef libc_fesetroundf
|
|
|
|
# define libc_fesetroundf default_libc_fesetround
|
|
|
|
#endif
|
|
|
|
#ifndef libc_fesetroundl
|
|
|
|
# define libc_fesetroundl default_libc_fesetround
|
|
|
|
#endif
|
|
|
|
|
2012-03-09 20:51:27 +00:00
|
|
|
static __always_inline void
|
|
|
|
default_libc_feholdexcept_setround (fenv_t *e, int r)
|
|
|
|
{
|
2015-01-05 23:06:14 +00:00
|
|
|
__feholdexcept (e);
|
2015-01-07 00:41:23 +00:00
|
|
|
__fesetround (r);
|
2012-03-09 20:51:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef libc_feholdexcept_setround
|
|
|
|
# define libc_feholdexcept_setround default_libc_feholdexcept_setround
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feholdexcept_setroundf
|
|
|
|
# define libc_feholdexcept_setroundf default_libc_feholdexcept_setround
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feholdexcept_setroundl
|
|
|
|
# define libc_feholdexcept_setroundl default_libc_feholdexcept_setround
|
|
|
|
#endif
|
|
|
|
|
2013-06-05 08:26:19 +00:00
|
|
|
#ifndef libc_feholdsetround_53bit
|
|
|
|
# define libc_feholdsetround_53bit libc_feholdsetround
|
2012-03-09 20:51:27 +00:00
|
|
|
#endif
|
2011-10-18 13:59:04 +00:00
|
|
|
|
2012-03-09 20:51:27 +00:00
|
|
|
#ifndef libc_fetestexcept
|
|
|
|
# define libc_fetestexcept fetestexcept
|
|
|
|
#endif
|
|
|
|
#ifndef libc_fetestexceptf
|
|
|
|
# define libc_fetestexceptf fetestexcept
|
|
|
|
#endif
|
|
|
|
#ifndef libc_fetestexceptl
|
|
|
|
# define libc_fetestexceptl fetestexcept
|
|
|
|
#endif
|
2012-03-14 16:20:10 +00:00
|
|
|
|
2012-03-09 20:51:27 +00:00
|
|
|
static __always_inline void
|
|
|
|
default_libc_fesetenv (fenv_t *e)
|
|
|
|
{
|
2015-01-06 23:36:20 +00:00
|
|
|
(void) __fesetenv (e);
|
2012-03-09 20:51:27 +00:00
|
|
|
}
|
2011-10-18 19:11:31 +00:00
|
|
|
|
2012-03-09 20:51:27 +00:00
|
|
|
#ifndef libc_fesetenv
|
|
|
|
# define libc_fesetenv default_libc_fesetenv
|
|
|
|
#endif
|
|
|
|
#ifndef libc_fesetenvf
|
|
|
|
# define libc_fesetenvf default_libc_fesetenv
|
|
|
|
#endif
|
|
|
|
#ifndef libc_fesetenvl
|
|
|
|
# define libc_fesetenvl default_libc_fesetenv
|
|
|
|
#endif
|
2011-10-18 13:00:46 +00:00
|
|
|
|
2012-03-09 20:51:27 +00:00
|
|
|
static __always_inline void
|
|
|
|
default_libc_feupdateenv (fenv_t *e)
|
|
|
|
{
|
2015-01-07 19:01:20 +00:00
|
|
|
(void) __feupdateenv (e);
|
2012-03-09 20:51:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef libc_feupdateenv
|
|
|
|
# define libc_feupdateenv default_libc_feupdateenv
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feupdateenvf
|
|
|
|
# define libc_feupdateenvf default_libc_feupdateenv
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feupdateenvl
|
|
|
|
# define libc_feupdateenvl default_libc_feupdateenv
|
|
|
|
#endif
|
2011-10-18 19:11:31 +00:00
|
|
|
|
2013-06-05 08:26:19 +00:00
|
|
|
#ifndef libc_feresetround_53bit
|
|
|
|
# define libc_feresetround_53bit libc_feresetround
|
2012-03-09 20:51:27 +00:00
|
|
|
#endif
|
2012-03-14 16:20:10 +00:00
|
|
|
|
2012-03-10 16:53:05 +00:00
|
|
|
static __always_inline int
|
|
|
|
default_libc_feupdateenv_test (fenv_t *e, int ex)
|
|
|
|
{
|
|
|
|
int ret = fetestexcept (ex);
|
2015-01-07 19:01:20 +00:00
|
|
|
__feupdateenv (e);
|
2012-03-10 16:53:05 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef libc_feupdateenv_test
|
|
|
|
# define libc_feupdateenv_test default_libc_feupdateenv_test
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feupdateenv_testf
|
|
|
|
# define libc_feupdateenv_testf default_libc_feupdateenv_test
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feupdateenv_testl
|
|
|
|
# define libc_feupdateenv_testl default_libc_feupdateenv_test
|
|
|
|
#endif
|
|
|
|
|
2012-03-10 16:55:53 +00:00
|
|
|
/* Save and set the rounding mode. The use of fenv_t to store the old mode
|
|
|
|
allows a target-specific version of this function to avoid converting the
|
|
|
|
rounding mode from the fpu format. By default we have no choice but to
|
|
|
|
manipulate the entire env. */
|
|
|
|
|
|
|
|
#ifndef libc_feholdsetround
|
|
|
|
# define libc_feholdsetround libc_feholdexcept_setround
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feholdsetroundf
|
|
|
|
# define libc_feholdsetroundf libc_feholdexcept_setroundf
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feholdsetroundl
|
|
|
|
# define libc_feholdsetroundl libc_feholdexcept_setroundl
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* ... and the reverse. */
|
|
|
|
|
|
|
|
#ifndef libc_feresetround
|
|
|
|
# define libc_feresetround libc_feupdateenv
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feresetroundf
|
|
|
|
# define libc_feresetroundf libc_feupdateenvf
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feresetroundl
|
|
|
|
# define libc_feresetroundl libc_feupdateenvl
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* ... and a version that may also discard exceptions. */
|
|
|
|
|
|
|
|
#ifndef libc_feresetround_noex
|
|
|
|
# define libc_feresetround_noex libc_fesetenv
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feresetround_noexf
|
|
|
|
# define libc_feresetround_noexf libc_fesetenvf
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feresetround_noexl
|
|
|
|
# define libc_feresetround_noexl libc_fesetenvl
|
|
|
|
#endif
|
|
|
|
|
2014-06-23 16:15:41 +00:00
|
|
|
#ifndef HAVE_RM_CTX
|
|
|
|
# define HAVE_RM_CTX 0
|
|
|
|
#endif
|
|
|
|
|
2014-03-17 20:36:06 +00:00
|
|
|
#if HAVE_RM_CTX
|
Set/restore rounding mode only when needed
The most common use case of math functions is with default rounding
mode, i.e. rounding to nearest. Setting and restoring rounding mode
is an unnecessary overhead for this, so I've added support for a
context, which does the set/restore only if the FP status needs a
change. The code is written such that only x86 uses these. Other
architectures should be unaffected by it, but would definitely benefit
if the set/restore has as much overhead relative to the rest of the
code, as the x86 bits do.
Here's a summary of the performance improvement due to these
improvements; I've only mentioned functions that use the set/restore
and have benchmark inputs for x86_64:
Before:
cos(): ITERS:4.69335e+08: TOTAL:28884.6Mcy, MAX:4080.28cy, MIN:57.562cy, 16248.6 calls/Mcy
exp(): ITERS:4.47604e+08: TOTAL:28796.2Mcy, MAX:207.721cy, MIN:62.385cy, 15543.9 calls/Mcy
pow(): ITERS:1.63485e+08: TOTAL:28879.9Mcy, MAX:362.255cy, MIN:172.469cy, 5660.86 calls/Mcy
sin(): ITERS:3.89578e+08: TOTAL:28900Mcy, MAX:704.859cy, MIN:47.583cy, 13480.2 calls/Mcy
tan(): ITERS:7.0971e+07: TOTAL:28902.2Mcy, MAX:1357.79cy, MIN:388.58cy, 2455.55 calls/Mcy
After:
cos(): ITERS:6.0014e+08: TOTAL:28875.9Mcy, MAX:364.283cy, MIN:45.716cy, 20783.4 calls/Mcy
exp(): ITERS:5.48578e+08: TOTAL:28764.9Mcy, MAX:191.617cy, MIN:51.011cy, 19071.1 calls/Mcy
pow(): ITERS:1.70013e+08: TOTAL:28873.6Mcy, MAX:689.522cy, MIN:163.989cy, 5888.18 calls/Mcy
sin(): ITERS:4.64079e+08: TOTAL:28891.5Mcy, MAX:6959.3cy, MIN:36.189cy, 16062.8 calls/Mcy
tan(): ITERS:7.2354e+07: TOTAL:28898.9Mcy, MAX:1295.57cy, MIN:380.698cy, 2503.7 calls/Mcy
So the improvements are:
cos: 27.9089%
exp: 22.6919%
pow: 4.01564%
sin: 19.1585%
tan: 1.96086%
The downside of the change is that it will have an adverse performance
impact on non-default rounding modes, but I think the tradeoff is
justified.
2013-06-12 05:06:48 +00:00
|
|
|
/* Set/Restore Rounding Modes only when necessary. If defined, these functions
|
|
|
|
set/restore floating point state only if the state needed within the lexical
|
|
|
|
block is different from the current state. This saves a lot of time when
|
|
|
|
the floating point unit is much slower than the fixed point units. */
|
|
|
|
|
2014-06-23 16:15:41 +00:00
|
|
|
# ifndef libc_feholdsetround_noex_ctx
|
|
|
|
# define libc_feholdsetround_noex_ctx libc_feholdsetround_ctx
|
|
|
|
# endif
|
|
|
|
# ifndef libc_feholdsetround_noexf_ctx
|
|
|
|
# define libc_feholdsetround_noexf_ctx libc_feholdsetroundf_ctx
|
|
|
|
# endif
|
|
|
|
# ifndef libc_feholdsetround_noexl_ctx
|
|
|
|
# define libc_feholdsetround_noexl_ctx libc_feholdsetroundl_ctx
|
|
|
|
# endif
|
|
|
|
|
Set/restore rounding mode only when needed
The most common use case of math functions is with default rounding
mode, i.e. rounding to nearest. Setting and restoring rounding mode
is an unnecessary overhead for this, so I've added support for a
context, which does the set/restore only if the FP status needs a
change. The code is written such that only x86 uses these. Other
architectures should be unaffected by it, but would definitely benefit
if the set/restore has as much overhead relative to the rest of the
code, as the x86 bits do.
Here's a summary of the performance improvement due to these
improvements; I've only mentioned functions that use the set/restore
and have benchmark inputs for x86_64:
Before:
cos(): ITERS:4.69335e+08: TOTAL:28884.6Mcy, MAX:4080.28cy, MIN:57.562cy, 16248.6 calls/Mcy
exp(): ITERS:4.47604e+08: TOTAL:28796.2Mcy, MAX:207.721cy, MIN:62.385cy, 15543.9 calls/Mcy
pow(): ITERS:1.63485e+08: TOTAL:28879.9Mcy, MAX:362.255cy, MIN:172.469cy, 5660.86 calls/Mcy
sin(): ITERS:3.89578e+08: TOTAL:28900Mcy, MAX:704.859cy, MIN:47.583cy, 13480.2 calls/Mcy
tan(): ITERS:7.0971e+07: TOTAL:28902.2Mcy, MAX:1357.79cy, MIN:388.58cy, 2455.55 calls/Mcy
After:
cos(): ITERS:6.0014e+08: TOTAL:28875.9Mcy, MAX:364.283cy, MIN:45.716cy, 20783.4 calls/Mcy
exp(): ITERS:5.48578e+08: TOTAL:28764.9Mcy, MAX:191.617cy, MIN:51.011cy, 19071.1 calls/Mcy
pow(): ITERS:1.70013e+08: TOTAL:28873.6Mcy, MAX:689.522cy, MIN:163.989cy, 5888.18 calls/Mcy
sin(): ITERS:4.64079e+08: TOTAL:28891.5Mcy, MAX:6959.3cy, MIN:36.189cy, 16062.8 calls/Mcy
tan(): ITERS:7.2354e+07: TOTAL:28898.9Mcy, MAX:1295.57cy, MIN:380.698cy, 2503.7 calls/Mcy
So the improvements are:
cos: 27.9089%
exp: 22.6919%
pow: 4.01564%
sin: 19.1585%
tan: 1.96086%
The downside of the change is that it will have an adverse performance
impact on non-default rounding modes, but I think the tradeoff is
justified.
2013-06-12 05:06:48 +00:00
|
|
|
# ifndef libc_feresetround_noex_ctx
|
|
|
|
# define libc_feresetround_noex_ctx libc_fesetenv_ctx
|
|
|
|
# endif
|
|
|
|
# ifndef libc_feresetround_noexf_ctx
|
|
|
|
# define libc_feresetround_noexf_ctx libc_fesetenvf_ctx
|
|
|
|
# endif
|
|
|
|
# ifndef libc_feresetround_noexl_ctx
|
|
|
|
# define libc_feresetround_noexl_ctx libc_fesetenvl_ctx
|
|
|
|
# endif
|
|
|
|
|
2014-06-23 16:15:41 +00:00
|
|
|
#else
|
Set/restore rounding mode only when needed
The most common use case of math functions is with default rounding
mode, i.e. rounding to nearest. Setting and restoring rounding mode
is an unnecessary overhead for this, so I've added support for a
context, which does the set/restore only if the FP status needs a
change. The code is written such that only x86 uses these. Other
architectures should be unaffected by it, but would definitely benefit
if the set/restore has as much overhead relative to the rest of the
code, as the x86 bits do.
Here's a summary of the performance improvement due to these
improvements; I've only mentioned functions that use the set/restore
and have benchmark inputs for x86_64:
Before:
cos(): ITERS:4.69335e+08: TOTAL:28884.6Mcy, MAX:4080.28cy, MIN:57.562cy, 16248.6 calls/Mcy
exp(): ITERS:4.47604e+08: TOTAL:28796.2Mcy, MAX:207.721cy, MIN:62.385cy, 15543.9 calls/Mcy
pow(): ITERS:1.63485e+08: TOTAL:28879.9Mcy, MAX:362.255cy, MIN:172.469cy, 5660.86 calls/Mcy
sin(): ITERS:3.89578e+08: TOTAL:28900Mcy, MAX:704.859cy, MIN:47.583cy, 13480.2 calls/Mcy
tan(): ITERS:7.0971e+07: TOTAL:28902.2Mcy, MAX:1357.79cy, MIN:388.58cy, 2455.55 calls/Mcy
After:
cos(): ITERS:6.0014e+08: TOTAL:28875.9Mcy, MAX:364.283cy, MIN:45.716cy, 20783.4 calls/Mcy
exp(): ITERS:5.48578e+08: TOTAL:28764.9Mcy, MAX:191.617cy, MIN:51.011cy, 19071.1 calls/Mcy
pow(): ITERS:1.70013e+08: TOTAL:28873.6Mcy, MAX:689.522cy, MIN:163.989cy, 5888.18 calls/Mcy
sin(): ITERS:4.64079e+08: TOTAL:28891.5Mcy, MAX:6959.3cy, MIN:36.189cy, 16062.8 calls/Mcy
tan(): ITERS:7.2354e+07: TOTAL:28898.9Mcy, MAX:1295.57cy, MIN:380.698cy, 2503.7 calls/Mcy
So the improvements are:
cos: 27.9089%
exp: 22.6919%
pow: 4.01564%
sin: 19.1585%
tan: 1.96086%
The downside of the change is that it will have an adverse performance
impact on non-default rounding modes, but I think the tradeoff is
justified.
2013-06-12 05:06:48 +00:00
|
|
|
|
2014-06-23 16:15:41 +00:00
|
|
|
/* Default implementation using standard fenv functions.
|
|
|
|
Avoid unnecessary rounding mode changes by first checking the
|
|
|
|
current rounding mode. Note the use of __glibc_unlikely is
|
|
|
|
important for performance. */
|
Set/restore rounding mode only when needed
The most common use case of math functions is with default rounding
mode, i.e. rounding to nearest. Setting and restoring rounding mode
is an unnecessary overhead for this, so I've added support for a
context, which does the set/restore only if the FP status needs a
change. The code is written such that only x86 uses these. Other
architectures should be unaffected by it, but would definitely benefit
if the set/restore has as much overhead relative to the rest of the
code, as the x86 bits do.
Here's a summary of the performance improvement due to these
improvements; I've only mentioned functions that use the set/restore
and have benchmark inputs for x86_64:
Before:
cos(): ITERS:4.69335e+08: TOTAL:28884.6Mcy, MAX:4080.28cy, MIN:57.562cy, 16248.6 calls/Mcy
exp(): ITERS:4.47604e+08: TOTAL:28796.2Mcy, MAX:207.721cy, MIN:62.385cy, 15543.9 calls/Mcy
pow(): ITERS:1.63485e+08: TOTAL:28879.9Mcy, MAX:362.255cy, MIN:172.469cy, 5660.86 calls/Mcy
sin(): ITERS:3.89578e+08: TOTAL:28900Mcy, MAX:704.859cy, MIN:47.583cy, 13480.2 calls/Mcy
tan(): ITERS:7.0971e+07: TOTAL:28902.2Mcy, MAX:1357.79cy, MIN:388.58cy, 2455.55 calls/Mcy
After:
cos(): ITERS:6.0014e+08: TOTAL:28875.9Mcy, MAX:364.283cy, MIN:45.716cy, 20783.4 calls/Mcy
exp(): ITERS:5.48578e+08: TOTAL:28764.9Mcy, MAX:191.617cy, MIN:51.011cy, 19071.1 calls/Mcy
pow(): ITERS:1.70013e+08: TOTAL:28873.6Mcy, MAX:689.522cy, MIN:163.989cy, 5888.18 calls/Mcy
sin(): ITERS:4.64079e+08: TOTAL:28891.5Mcy, MAX:6959.3cy, MIN:36.189cy, 16062.8 calls/Mcy
tan(): ITERS:7.2354e+07: TOTAL:28898.9Mcy, MAX:1295.57cy, MIN:380.698cy, 2503.7 calls/Mcy
So the improvements are:
cos: 27.9089%
exp: 22.6919%
pow: 4.01564%
sin: 19.1585%
tan: 1.96086%
The downside of the change is that it will have an adverse performance
impact on non-default rounding modes, but I think the tradeoff is
justified.
2013-06-12 05:06:48 +00:00
|
|
|
|
2014-06-23 16:15:41 +00:00
|
|
|
static __always_inline void
|
|
|
|
libc_feholdsetround_ctx (struct rm_ctx *ctx, int round)
|
|
|
|
{
|
|
|
|
ctx->updated_status = false;
|
|
|
|
|
|
|
|
/* Update rounding mode only if different. */
|
|
|
|
if (__glibc_unlikely (round != get_rounding_mode ()))
|
|
|
|
{
|
|
|
|
ctx->updated_status = true;
|
2014-12-31 22:07:52 +00:00
|
|
|
__fegetenv (&ctx->env);
|
2015-01-07 00:41:23 +00:00
|
|
|
__fesetround (round);
|
2014-06-23 16:15:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static __always_inline void
|
|
|
|
libc_feresetround_ctx (struct rm_ctx *ctx)
|
|
|
|
{
|
|
|
|
/* Restore the rounding mode if updated. */
|
|
|
|
if (__glibc_unlikely (ctx->updated_status))
|
2015-01-07 19:01:20 +00:00
|
|
|
__feupdateenv (&ctx->env);
|
2014-06-23 16:15:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static __always_inline void
|
|
|
|
libc_feholdsetround_noex_ctx (struct rm_ctx *ctx, int round)
|
|
|
|
{
|
|
|
|
/* Save exception flags and rounding mode. */
|
2014-12-31 22:07:52 +00:00
|
|
|
__fegetenv (&ctx->env);
|
2014-06-23 16:15:41 +00:00
|
|
|
|
|
|
|
/* Update rounding mode only if different. */
|
|
|
|
if (__glibc_unlikely (round != get_rounding_mode ()))
|
2015-01-07 00:41:23 +00:00
|
|
|
__fesetround (round);
|
2014-06-23 16:15:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static __always_inline void
|
|
|
|
libc_feresetround_noex_ctx (struct rm_ctx *ctx)
|
|
|
|
{
|
|
|
|
/* Restore exception flags and rounding mode. */
|
2015-01-06 23:36:20 +00:00
|
|
|
__fesetenv (&ctx->env);
|
2014-06-23 16:15:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# define libc_feholdsetroundf_ctx libc_feholdsetround_ctx
|
|
|
|
# define libc_feholdsetroundl_ctx libc_feholdsetround_ctx
|
|
|
|
# define libc_feresetroundf_ctx libc_feresetround_ctx
|
|
|
|
# define libc_feresetroundl_ctx libc_feresetround_ctx
|
|
|
|
|
|
|
|
# define libc_feholdsetround_noexf_ctx libc_feholdsetround_noex_ctx
|
|
|
|
# define libc_feholdsetround_noexl_ctx libc_feholdsetround_noex_ctx
|
|
|
|
# define libc_feresetround_noexf_ctx libc_feresetround_noex_ctx
|
|
|
|
# define libc_feresetround_noexl_ctx libc_feresetround_noex_ctx
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef libc_feholdsetround_53bit_ctx
|
|
|
|
# define libc_feholdsetround_53bit_ctx libc_feholdsetround_ctx
|
|
|
|
#endif
|
|
|
|
#ifndef libc_feresetround_53bit_ctx
|
|
|
|
# define libc_feresetround_53bit_ctx libc_feresetround_ctx
|
Set/restore rounding mode only when needed
The most common use case of math functions is with default rounding
mode, i.e. rounding to nearest. Setting and restoring rounding mode
is an unnecessary overhead for this, so I've added support for a
context, which does the set/restore only if the FP status needs a
change. The code is written such that only x86 uses these. Other
architectures should be unaffected by it, but would definitely benefit
if the set/restore has as much overhead relative to the rest of the
code, as the x86 bits do.
Here's a summary of the performance improvement due to these
improvements; I've only mentioned functions that use the set/restore
and have benchmark inputs for x86_64:
Before:
cos(): ITERS:4.69335e+08: TOTAL:28884.6Mcy, MAX:4080.28cy, MIN:57.562cy, 16248.6 calls/Mcy
exp(): ITERS:4.47604e+08: TOTAL:28796.2Mcy, MAX:207.721cy, MIN:62.385cy, 15543.9 calls/Mcy
pow(): ITERS:1.63485e+08: TOTAL:28879.9Mcy, MAX:362.255cy, MIN:172.469cy, 5660.86 calls/Mcy
sin(): ITERS:3.89578e+08: TOTAL:28900Mcy, MAX:704.859cy, MIN:47.583cy, 13480.2 calls/Mcy
tan(): ITERS:7.0971e+07: TOTAL:28902.2Mcy, MAX:1357.79cy, MIN:388.58cy, 2455.55 calls/Mcy
After:
cos(): ITERS:6.0014e+08: TOTAL:28875.9Mcy, MAX:364.283cy, MIN:45.716cy, 20783.4 calls/Mcy
exp(): ITERS:5.48578e+08: TOTAL:28764.9Mcy, MAX:191.617cy, MIN:51.011cy, 19071.1 calls/Mcy
pow(): ITERS:1.70013e+08: TOTAL:28873.6Mcy, MAX:689.522cy, MIN:163.989cy, 5888.18 calls/Mcy
sin(): ITERS:4.64079e+08: TOTAL:28891.5Mcy, MAX:6959.3cy, MIN:36.189cy, 16062.8 calls/Mcy
tan(): ITERS:7.2354e+07: TOTAL:28898.9Mcy, MAX:1295.57cy, MIN:380.698cy, 2503.7 calls/Mcy
So the improvements are:
cos: 27.9089%
exp: 22.6919%
pow: 4.01564%
sin: 19.1585%
tan: 1.96086%
The downside of the change is that it will have an adverse performance
impact on non-default rounding modes, but I think the tradeoff is
justified.
2013-06-12 05:06:48 +00:00
|
|
|
#endif
|
|
|
|
|
2014-06-23 16:15:41 +00:00
|
|
|
#define SET_RESTORE_ROUND_GENERIC(RM,ROUNDFUNC,CLEANUPFUNC) \
|
|
|
|
struct rm_ctx ctx __attribute__((cleanup (CLEANUPFUNC ## _ctx))); \
|
|
|
|
ROUNDFUNC ## _ctx (&ctx, (RM))
|
|
|
|
|
|
|
|
/* Set the rounding mode within a lexical block. Restore the rounding mode to
|
|
|
|
the value at the start of the block. The exception mode must be preserved.
|
|
|
|
Exceptions raised within the block must be set in the exception flags.
|
|
|
|
Non-stop mode may be enabled inside the block. */
|
2012-03-10 16:55:53 +00:00
|
|
|
|
|
|
|
#define SET_RESTORE_ROUND(RM) \
|
Set/restore rounding mode only when needed
The most common use case of math functions is with default rounding
mode, i.e. rounding to nearest. Setting and restoring rounding mode
is an unnecessary overhead for this, so I've added support for a
context, which does the set/restore only if the FP status needs a
change. The code is written such that only x86 uses these. Other
architectures should be unaffected by it, but would definitely benefit
if the set/restore has as much overhead relative to the rest of the
code, as the x86 bits do.
Here's a summary of the performance improvement due to these
improvements; I've only mentioned functions that use the set/restore
and have benchmark inputs for x86_64:
Before:
cos(): ITERS:4.69335e+08: TOTAL:28884.6Mcy, MAX:4080.28cy, MIN:57.562cy, 16248.6 calls/Mcy
exp(): ITERS:4.47604e+08: TOTAL:28796.2Mcy, MAX:207.721cy, MIN:62.385cy, 15543.9 calls/Mcy
pow(): ITERS:1.63485e+08: TOTAL:28879.9Mcy, MAX:362.255cy, MIN:172.469cy, 5660.86 calls/Mcy
sin(): ITERS:3.89578e+08: TOTAL:28900Mcy, MAX:704.859cy, MIN:47.583cy, 13480.2 calls/Mcy
tan(): ITERS:7.0971e+07: TOTAL:28902.2Mcy, MAX:1357.79cy, MIN:388.58cy, 2455.55 calls/Mcy
After:
cos(): ITERS:6.0014e+08: TOTAL:28875.9Mcy, MAX:364.283cy, MIN:45.716cy, 20783.4 calls/Mcy
exp(): ITERS:5.48578e+08: TOTAL:28764.9Mcy, MAX:191.617cy, MIN:51.011cy, 19071.1 calls/Mcy
pow(): ITERS:1.70013e+08: TOTAL:28873.6Mcy, MAX:689.522cy, MIN:163.989cy, 5888.18 calls/Mcy
sin(): ITERS:4.64079e+08: TOTAL:28891.5Mcy, MAX:6959.3cy, MIN:36.189cy, 16062.8 calls/Mcy
tan(): ITERS:7.2354e+07: TOTAL:28898.9Mcy, MAX:1295.57cy, MIN:380.698cy, 2503.7 calls/Mcy
So the improvements are:
cos: 27.9089%
exp: 22.6919%
pow: 4.01564%
sin: 19.1585%
tan: 1.96086%
The downside of the change is that it will have an adverse performance
impact on non-default rounding modes, but I think the tradeoff is
justified.
2013-06-12 05:06:48 +00:00
|
|
|
SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround, libc_feresetround)
|
2012-03-10 16:55:53 +00:00
|
|
|
#define SET_RESTORE_ROUNDF(RM) \
|
Set/restore rounding mode only when needed
The most common use case of math functions is with default rounding
mode, i.e. rounding to nearest. Setting and restoring rounding mode
is an unnecessary overhead for this, so I've added support for a
context, which does the set/restore only if the FP status needs a
change. The code is written such that only x86 uses these. Other
architectures should be unaffected by it, but would definitely benefit
if the set/restore has as much overhead relative to the rest of the
code, as the x86 bits do.
Here's a summary of the performance improvement due to these
improvements; I've only mentioned functions that use the set/restore
and have benchmark inputs for x86_64:
Before:
cos(): ITERS:4.69335e+08: TOTAL:28884.6Mcy, MAX:4080.28cy, MIN:57.562cy, 16248.6 calls/Mcy
exp(): ITERS:4.47604e+08: TOTAL:28796.2Mcy, MAX:207.721cy, MIN:62.385cy, 15543.9 calls/Mcy
pow(): ITERS:1.63485e+08: TOTAL:28879.9Mcy, MAX:362.255cy, MIN:172.469cy, 5660.86 calls/Mcy
sin(): ITERS:3.89578e+08: TOTAL:28900Mcy, MAX:704.859cy, MIN:47.583cy, 13480.2 calls/Mcy
tan(): ITERS:7.0971e+07: TOTAL:28902.2Mcy, MAX:1357.79cy, MIN:388.58cy, 2455.55 calls/Mcy
After:
cos(): ITERS:6.0014e+08: TOTAL:28875.9Mcy, MAX:364.283cy, MIN:45.716cy, 20783.4 calls/Mcy
exp(): ITERS:5.48578e+08: TOTAL:28764.9Mcy, MAX:191.617cy, MIN:51.011cy, 19071.1 calls/Mcy
pow(): ITERS:1.70013e+08: TOTAL:28873.6Mcy, MAX:689.522cy, MIN:163.989cy, 5888.18 calls/Mcy
sin(): ITERS:4.64079e+08: TOTAL:28891.5Mcy, MAX:6959.3cy, MIN:36.189cy, 16062.8 calls/Mcy
tan(): ITERS:7.2354e+07: TOTAL:28898.9Mcy, MAX:1295.57cy, MIN:380.698cy, 2503.7 calls/Mcy
So the improvements are:
cos: 27.9089%
exp: 22.6919%
pow: 4.01564%
sin: 19.1585%
tan: 1.96086%
The downside of the change is that it will have an adverse performance
impact on non-default rounding modes, but I think the tradeoff is
justified.
2013-06-12 05:06:48 +00:00
|
|
|
SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetroundf, libc_feresetroundf)
|
2012-03-10 16:55:53 +00:00
|
|
|
#define SET_RESTORE_ROUNDL(RM) \
|
Set/restore rounding mode only when needed
The most common use case of math functions is with default rounding
mode, i.e. rounding to nearest. Setting and restoring rounding mode
is an unnecessary overhead for this, so I've added support for a
context, which does the set/restore only if the FP status needs a
change. The code is written such that only x86 uses these. Other
architectures should be unaffected by it, but would definitely benefit
if the set/restore has as much overhead relative to the rest of the
code, as the x86 bits do.
Here's a summary of the performance improvement due to these
improvements; I've only mentioned functions that use the set/restore
and have benchmark inputs for x86_64:
Before:
cos(): ITERS:4.69335e+08: TOTAL:28884.6Mcy, MAX:4080.28cy, MIN:57.562cy, 16248.6 calls/Mcy
exp(): ITERS:4.47604e+08: TOTAL:28796.2Mcy, MAX:207.721cy, MIN:62.385cy, 15543.9 calls/Mcy
pow(): ITERS:1.63485e+08: TOTAL:28879.9Mcy, MAX:362.255cy, MIN:172.469cy, 5660.86 calls/Mcy
sin(): ITERS:3.89578e+08: TOTAL:28900Mcy, MAX:704.859cy, MIN:47.583cy, 13480.2 calls/Mcy
tan(): ITERS:7.0971e+07: TOTAL:28902.2Mcy, MAX:1357.79cy, MIN:388.58cy, 2455.55 calls/Mcy
After:
cos(): ITERS:6.0014e+08: TOTAL:28875.9Mcy, MAX:364.283cy, MIN:45.716cy, 20783.4 calls/Mcy
exp(): ITERS:5.48578e+08: TOTAL:28764.9Mcy, MAX:191.617cy, MIN:51.011cy, 19071.1 calls/Mcy
pow(): ITERS:1.70013e+08: TOTAL:28873.6Mcy, MAX:689.522cy, MIN:163.989cy, 5888.18 calls/Mcy
sin(): ITERS:4.64079e+08: TOTAL:28891.5Mcy, MAX:6959.3cy, MIN:36.189cy, 16062.8 calls/Mcy
tan(): ITERS:7.2354e+07: TOTAL:28898.9Mcy, MAX:1295.57cy, MIN:380.698cy, 2503.7 calls/Mcy
So the improvements are:
cos: 27.9089%
exp: 22.6919%
pow: 4.01564%
sin: 19.1585%
tan: 1.96086%
The downside of the change is that it will have an adverse performance
impact on non-default rounding modes, but I think the tradeoff is
justified.
2013-06-12 05:06:48 +00:00
|
|
|
SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetroundl, libc_feresetroundl)
|
2012-03-10 16:55:53 +00:00
|
|
|
|
2014-06-23 16:15:41 +00:00
|
|
|
/* Set the rounding mode within a lexical block. Restore the rounding mode to
|
|
|
|
the value at the start of the block. The exception mode must be preserved.
|
|
|
|
Exceptions raised within the block must be discarded, and exception flags
|
|
|
|
are restored to the value at the start of the block.
|
|
|
|
Non-stop mode may be enabled inside the block. */
|
2012-03-10 16:55:53 +00:00
|
|
|
|
|
|
|
#define SET_RESTORE_ROUND_NOEX(RM) \
|
2014-06-23 16:15:41 +00:00
|
|
|
SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround_noex, \
|
|
|
|
libc_feresetround_noex)
|
2012-03-10 16:55:53 +00:00
|
|
|
#define SET_RESTORE_ROUND_NOEXF(RM) \
|
2014-06-23 16:15:41 +00:00
|
|
|
SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround_noexf, \
|
|
|
|
libc_feresetround_noexf)
|
2012-03-10 16:55:53 +00:00
|
|
|
#define SET_RESTORE_ROUND_NOEXL(RM) \
|
2014-06-23 16:15:41 +00:00
|
|
|
SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround_noexl, \
|
|
|
|
libc_feresetround_noexl)
|
2012-03-10 16:55:53 +00:00
|
|
|
|
|
|
|
/* Like SET_RESTORE_ROUND, but also set rounding precision to 53 bits. */
|
|
|
|
#define SET_RESTORE_ROUND_53BIT(RM) \
|
Set/restore rounding mode only when needed
The most common use case of math functions is with default rounding
mode, i.e. rounding to nearest. Setting and restoring rounding mode
is an unnecessary overhead for this, so I've added support for a
context, which does the set/restore only if the FP status needs a
change. The code is written such that only x86 uses these. Other
architectures should be unaffected by it, but would definitely benefit
if the set/restore has as much overhead relative to the rest of the
code, as the x86 bits do.
Here's a summary of the performance improvement due to these
improvements; I've only mentioned functions that use the set/restore
and have benchmark inputs for x86_64:
Before:
cos(): ITERS:4.69335e+08: TOTAL:28884.6Mcy, MAX:4080.28cy, MIN:57.562cy, 16248.6 calls/Mcy
exp(): ITERS:4.47604e+08: TOTAL:28796.2Mcy, MAX:207.721cy, MIN:62.385cy, 15543.9 calls/Mcy
pow(): ITERS:1.63485e+08: TOTAL:28879.9Mcy, MAX:362.255cy, MIN:172.469cy, 5660.86 calls/Mcy
sin(): ITERS:3.89578e+08: TOTAL:28900Mcy, MAX:704.859cy, MIN:47.583cy, 13480.2 calls/Mcy
tan(): ITERS:7.0971e+07: TOTAL:28902.2Mcy, MAX:1357.79cy, MIN:388.58cy, 2455.55 calls/Mcy
After:
cos(): ITERS:6.0014e+08: TOTAL:28875.9Mcy, MAX:364.283cy, MIN:45.716cy, 20783.4 calls/Mcy
exp(): ITERS:5.48578e+08: TOTAL:28764.9Mcy, MAX:191.617cy, MIN:51.011cy, 19071.1 calls/Mcy
pow(): ITERS:1.70013e+08: TOTAL:28873.6Mcy, MAX:689.522cy, MIN:163.989cy, 5888.18 calls/Mcy
sin(): ITERS:4.64079e+08: TOTAL:28891.5Mcy, MAX:6959.3cy, MIN:36.189cy, 16062.8 calls/Mcy
tan(): ITERS:7.2354e+07: TOTAL:28898.9Mcy, MAX:1295.57cy, MIN:380.698cy, 2503.7 calls/Mcy
So the improvements are:
cos: 27.9089%
exp: 22.6919%
pow: 4.01564%
sin: 19.1585%
tan: 1.96086%
The downside of the change is that it will have an adverse performance
impact on non-default rounding modes, but I think the tradeoff is
justified.
2013-06-12 05:06:48 +00:00
|
|
|
SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround_53bit, \
|
|
|
|
libc_feresetround_53bit)
|
2012-03-10 16:55:53 +00:00
|
|
|
|
2011-10-22 04:32:39 +00:00
|
|
|
#define __nan(str) \
|
|
|
|
(__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str))
|
|
|
|
#define __nanf(str) \
|
|
|
|
(__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str))
|
|
|
|
#define __nanl(str) \
|
|
|
|
(__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str))
|
|
|
|
|
1996-03-05 21:41:30 +00:00
|
|
|
#endif /* _MATH_PRIVATE_H_ */
|