mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-27 03:41:23 +08:00
76060ec0b8
* 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.
347 lines
10 KiB
C
347 lines
10 KiB
C
/*
|
|
* ====================================================
|
|
* 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
|
|
* $Id$
|
|
*/
|
|
|
|
#ifndef _MATH_PRIVATE_H_
|
|
#define _MATH_PRIVATE_H_
|
|
|
|
#include <machine/endian.h>
|
|
#include <sys/types.h>
|
|
|
|
/* 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. */
|
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
|
|
|
typedef union
|
|
{
|
|
double value;
|
|
struct
|
|
{
|
|
u_int32_t msw;
|
|
u_int32_t lsw;
|
|
} parts;
|
|
} ieee_double_shape_type;
|
|
|
|
#endif
|
|
|
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
|
|
|
typedef union
|
|
{
|
|
double value;
|
|
struct
|
|
{
|
|
u_int32_t lsw;
|
|
u_int32_t msw;
|
|
} parts;
|
|
} 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. */
|
|
|
|
#define GET_HIGH_WORD(i,d) \
|
|
do { \
|
|
ieee_double_shape_type gh_u; \
|
|
gh_u.value = (d); \
|
|
(i) = gh_u.parts.msw; \
|
|
} while (0)
|
|
|
|
/* Get the less significant 32 bit int from a double. */
|
|
|
|
#define GET_LOW_WORD(i,d) \
|
|
do { \
|
|
ieee_double_shape_type gl_u; \
|
|
gl_u.value = (d); \
|
|
(i) = gl_u.parts.lsw; \
|
|
} while (0)
|
|
|
|
/* Set a double from two 32 bit ints. */
|
|
|
|
#define INSERT_WORDS(d,ix0,ix1) \
|
|
do { \
|
|
ieee_double_shape_type iw_u; \
|
|
iw_u.parts.msw = (ix0); \
|
|
iw_u.parts.lsw = (ix1); \
|
|
(d) = iw_u.value; \
|
|
} while (0)
|
|
|
|
/* Set the more significant 32 bits of a double from an int. */
|
|
|
|
#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)
|
|
|
|
/* Set the less significant 32 bits of a double from an int. */
|
|
|
|
#define SET_LOW_WORD(d,v) \
|
|
do { \
|
|
ieee_double_shape_type sl_u; \
|
|
sl_u.value = (d); \
|
|
sl_u.parts.lsw = (v); \
|
|
(d) = sl_u.value; \
|
|
} while (0)
|
|
|
|
/* 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. */
|
|
|
|
#define GET_FLOAT_WORD(i,d) \
|
|
do { \
|
|
ieee_float_shape_type gf_u; \
|
|
gf_u.value = (d); \
|
|
(i) = gf_u.word; \
|
|
} while (0)
|
|
|
|
/* Set a float from a 32 bit int. */
|
|
|
|
#define SET_FLOAT_WORD(d,i) \
|
|
do { \
|
|
ieee_float_shape_type sf_u; \
|
|
sf_u.word = (i); \
|
|
(d) = sf_u.value; \
|
|
} while (0)
|
|
|
|
/* A union which permits us to convert between a long double and
|
|
three 32 bit ints. */
|
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
|
|
|
typedef union
|
|
{
|
|
long double value;
|
|
struct
|
|
{
|
|
unsigned int sign_exponent:16;
|
|
unsigned int empty:16;
|
|
u_int32_t msw;
|
|
u_int32_t lsw;
|
|
} parts;
|
|
} ieee_long_double_shape_type;
|
|
|
|
#endif
|
|
|
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
|
|
|
typedef union
|
|
{
|
|
long double value;
|
|
struct
|
|
{
|
|
u_int32_t lsw;
|
|
u_int32_t msw;
|
|
unsigned int sign_exponent:16;
|
|
unsigned int empty:16;
|
|
} parts;
|
|
} ieee_long_double_shape_type;
|
|
|
|
#endif
|
|
|
|
/* Get three 32 bit ints from a double. */
|
|
|
|
#define GET_LDOUBLE_WORDS(exp,ix0,ix1,d) \
|
|
do { \
|
|
ieee_long_double_shape_type ew_u; \
|
|
ew_u.value = (d); \
|
|
(exp) = ew_u.parts.sign_exponent; \
|
|
(ix0) = ew_u.parts.msw; \
|
|
(ix1) = ew_u.parts.lsw; \
|
|
} while (0)
|
|
|
|
/* Set a double from two 32 bit ints. */
|
|
|
|
#define SET_LDOUBLE_WORDS(d,exp,ix0,ix1) \
|
|
do { \
|
|
ieee_long_double_shape_type iw_u; \
|
|
iw_u.parts.sign_exponent = (exp); \
|
|
iw_u.parts.msw = (ix0); \
|
|
iw_u.parts.lsw = (ix1); \
|
|
(d) = iw_u.value; \
|
|
} while (0)
|
|
|
|
/* Set the more significant 32 bits of a long double mantissa from an int. */
|
|
|
|
#define SET_LDOUBLE_MSW(d,v) \
|
|
do { \
|
|
ieee_long_double_shape_type sh_u; \
|
|
sh_u.value = (d); \
|
|
sh_u.parts.msw = (v); \
|
|
(d) = sh_u.value; \
|
|
} while (0)
|
|
|
|
/* Get int from the exponent of a long double. */
|
|
|
|
#define GET_LDOUBLE_EXP(exp,d) \
|
|
do { \
|
|
ieee_long_double_shape_type ge_u; \
|
|
ge_u.value = (d);
|
|
(exp) = ge_u.parts.sign_exponent; \
|
|
} while (0)
|
|
|
|
/* Set exponent of a long double from an int. */
|
|
|
|
#define SET_LDOUBLE_EXP(d,exp) \
|
|
do { \
|
|
ieee_long_double_shape_type se_u; \
|
|
se_u.value = (d); \
|
|
se_u.parts.sign_exponent = (exp); \
|
|
(d) = se_u.value; \
|
|
} while (0)
|
|
|
|
|
|
/* ieee style elementary functions */
|
|
extern double __ieee754_sqrt __P((double));
|
|
extern double __ieee754_acos __P((double));
|
|
extern double __ieee754_acosh __P((double));
|
|
extern double __ieee754_log __P((double));
|
|
extern double __ieee754_atanh __P((double));
|
|
extern double __ieee754_asin __P((double));
|
|
extern double __ieee754_atan2 __P((double,double));
|
|
extern double __ieee754_exp __P((double));
|
|
extern double __ieee754_cosh __P((double));
|
|
extern double __ieee754_fmod __P((double,double));
|
|
extern double __ieee754_pow __P((double,double));
|
|
extern double __ieee754_lgamma_r __P((double,int *));
|
|
extern double __ieee754_gamma_r __P((double,int *));
|
|
extern double __ieee754_lgamma __P((double));
|
|
extern double __ieee754_gamma __P((double));
|
|
extern double __ieee754_log10 __P((double));
|
|
extern double __ieee754_sinh __P((double));
|
|
extern double __ieee754_hypot __P((double,double));
|
|
extern double __ieee754_j0 __P((double));
|
|
extern double __ieee754_j1 __P((double));
|
|
extern double __ieee754_y0 __P((double));
|
|
extern double __ieee754_y1 __P((double));
|
|
extern double __ieee754_jn __P((int,double));
|
|
extern double __ieee754_yn __P((int,double));
|
|
extern double __ieee754_remainder __P((double,double));
|
|
extern int __ieee754_rem_pio2 __P((double,double*));
|
|
extern double __ieee754_scalb __P((double,double));
|
|
|
|
/* fdlibm kernel function */
|
|
extern double __kernel_standard __P((double,double,int));
|
|
extern double __kernel_sin __P((double,double,int));
|
|
extern double __kernel_cos __P((double,double));
|
|
extern double __kernel_tan __P((double,double,int));
|
|
extern int __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*));
|
|
|
|
|
|
/* ieee style elementary float functions */
|
|
extern float __ieee754_sqrtf __P((float));
|
|
extern float __ieee754_acosf __P((float));
|
|
extern float __ieee754_acoshf __P((float));
|
|
extern float __ieee754_logf __P((float));
|
|
extern float __ieee754_atanhf __P((float));
|
|
extern float __ieee754_asinf __P((float));
|
|
extern float __ieee754_atan2f __P((float,float));
|
|
extern float __ieee754_expf __P((float));
|
|
extern float __ieee754_coshf __P((float));
|
|
extern float __ieee754_fmodf __P((float,float));
|
|
extern float __ieee754_powf __P((float,float));
|
|
extern float __ieee754_lgammaf_r __P((float,int *));
|
|
extern float __ieee754_gammaf_r __P((float,int *));
|
|
extern float __ieee754_lgammaf __P((float));
|
|
extern float __ieee754_gammaf __P((float));
|
|
extern float __ieee754_log10f __P((float));
|
|
extern float __ieee754_sinhf __P((float));
|
|
extern float __ieee754_hypotf __P((float,float));
|
|
extern float __ieee754_j0f __P((float));
|
|
extern float __ieee754_j1f __P((float));
|
|
extern float __ieee754_y0f __P((float));
|
|
extern float __ieee754_y1f __P((float));
|
|
extern float __ieee754_jnf __P((int,float));
|
|
extern float __ieee754_ynf __P((int,float));
|
|
extern float __ieee754_remainderf __P((float,float));
|
|
extern int __ieee754_rem_pio2f __P((float,float*));
|
|
extern float __ieee754_scalbf __P((float,float));
|
|
|
|
/* float versions of fdlibm kernel functions */
|
|
extern float __kernel_sinf __P((float,float,int));
|
|
extern float __kernel_cosf __P((float,float));
|
|
extern float __kernel_tanf __P((float,float,int));
|
|
extern int __kernel_rem_pio2f __P((float*,float*,int,int,int,const int*));
|
|
|
|
|
|
/* ieee style elementary long double functions */
|
|
extern long double __ieee754_sqrtl __P((long double));
|
|
extern long double __ieee754_acosl __P((long double));
|
|
extern long double __ieee754_acoshl __P((long double));
|
|
extern long double __ieee754_logl __P((long double));
|
|
extern long double __ieee754_atanhl __P((long double));
|
|
extern long double __ieee754_asinl __P((long double));
|
|
extern long double __ieee754_atan2l __P((long double,long double));
|
|
extern long double __ieee754_expl __P((long double));
|
|
extern long double __ieee754_coshl __P((long double));
|
|
extern long double __ieee754_fmodl __P((long double,long double));
|
|
extern long double __ieee754_powl __P((long double,long double));
|
|
extern long double __ieee754_lgammal_r __P((long double,int *));
|
|
extern long double __ieee754_gammal_r __P((long double,int *));
|
|
extern long double __ieee754_lgammal __P((long double));
|
|
extern long double __ieee754_gammal __P((long double));
|
|
extern long double __ieee754_log10l __P((long double));
|
|
extern long double __ieee754_sinhl __P((long double));
|
|
extern long double __ieee754_hypotl __P((long double,long double));
|
|
extern long double __ieee754_j0l __P((long double));
|
|
extern long double __ieee754_j1l __P((long double));
|
|
extern long double __ieee754_y0l __P((long double));
|
|
extern long double __ieee754_y1l __P((long double));
|
|
extern long double __ieee754_jnl __P((int,long double));
|
|
extern long double __ieee754_ynl __P((int,long double));
|
|
extern long double __ieee754_remainderl __P((long double,long double));
|
|
extern int __ieee754_rem_pio2l __P((long double,long double*));
|
|
extern long double __ieee754_scalbl __P((long double,long double));
|
|
|
|
/* long double versions of fdlibm kernel functions */
|
|
extern long double __kernel_sinl __P((long double,long double,int));
|
|
extern long double __kernel_cosl __P((long double,long double));
|
|
extern long double __kernel_tanl __P((long double,long double,int));
|
|
extern int __kernel_rem_pio2l __P((long double*,long double*,int,int,
|
|
int,const int*));
|
|
|
|
#endif /* _MATH_PRIVATE_H_ */
|