mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-19 13:40:59 +08:00
Update.
This commit is contained in:
parent
86421aa57e
commit
abfbdde177
@ -1,4 +0,0 @@
|
||||
/* math_private.h wants to include <machine/endian.h>; we provide this
|
||||
file so it can, leaving math_private.h unmodified from the original. */
|
||||
|
||||
#include <endian.h>
|
@ -17,7 +17,7 @@
|
||||
#ifndef _MATH_PRIVATE_H_
|
||||
#define _MATH_PRIVATE_H_
|
||||
|
||||
#include <machine/endian.h>
|
||||
#include <endian.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* The original fdlibm code used statements like:
|
||||
@ -147,101 +147,8 @@ do { \
|
||||
(d) = sf_u.value; \
|
||||
} while (0)
|
||||
|
||||
/* A union which permits us to convert between a long double and
|
||||
three 32 bit ints. */
|
||||
|
||||
#if __FLOAT_WORD_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 __FLOAT_WORD_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)
|
||||
|
||||
/* Get the more significant 32 bits of a long double mantissa. */
|
||||
|
||||
#define GET_LDOUBLE_MSW(v,d) \
|
||||
do { \
|
||||
ieee_long_double_shape_type sh_u; \
|
||||
sh_u.value = (d); \
|
||||
(v) = sh_u.parts.msw; \
|
||||
} 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)
|
||||
|
||||
/* Get long double macros from a separate header. */
|
||||
#include <math_ldbl.h>
|
||||
|
||||
/* ieee style elementary functions */
|
||||
extern double __ieee754_sqrt __P((double));
|
||||
|
@ -439,9 +439,28 @@ __printf_fp (FILE *fp,
|
||||
{
|
||||
if (scalesize == 0)
|
||||
{
|
||||
tmpsize = powers->arraysize;
|
||||
memcpy (tmp, &__tens[powers->arrayoff],
|
||||
tmpsize * sizeof (mp_limb_t));
|
||||
#ifndef __NO_LONG_DOUBLE_MATH
|
||||
if (LDBL_MANT_DIG > _FPIO_CONST_OFFSET * BITS_PER_MP_LIMB
|
||||
&& info->is_long_double)
|
||||
{
|
||||
#define _FPIO_CONST_SHIFT \
|
||||
(((LDBL_MANT_DIG + BITS_PER_MP_LIMB - 1) / BITS_PER_MP_LIMB) \
|
||||
- _FPIO_CONST_OFFSET)
|
||||
/* 64bit const offset is not enough for
|
||||
IEEE quad long double. */
|
||||
tmpsize = powers->arraysize + _FPIO_CONST_SHIFT;
|
||||
memcpy (tmp + _FPIO_CONST_SHIFT,
|
||||
&__tens[powers->arrayoff],
|
||||
tmpsize * sizeof (mp_limb_t));
|
||||
MPN_ZERO (tmp, _FPIO_CONST_SHIFT);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
tmpsize = powers->arraysize;
|
||||
memcpy (tmp, &__tens[powers->arrayoff],
|
||||
tmpsize * sizeof (mp_limb_t));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,3 +1,4 @@
|
||||
wordsize-64
|
||||
# Alpha uses IEEE 754 floating point.
|
||||
ieee754
|
||||
# Alpha uses IEEE 754 single and double precision floating point.
|
||||
ieee754/flt-32
|
||||
ieee754/dbl-64
|
||||
|
@ -1,2 +1,3 @@
|
||||
wordsize-32
|
||||
ieee754
|
||||
ieee754/flt-32
|
||||
ieee754/dbl-64
|
||||
|
14
sysdeps/generic/e_atanhl.c
Normal file
14
sysdeps/generic/e_atanhl.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
long double
|
||||
__ieee754_atanhl (long double x)
|
||||
{
|
||||
fputs ("__ieee754_atanhl not implemented\n", stderr);
|
||||
__set_errno (ENOSYS);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
stub_warning (__ieee754_atanhl)
|
||||
#include <stub-tag.h>
|
14
sysdeps/generic/e_coshl.c
Normal file
14
sysdeps/generic/e_coshl.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
long double
|
||||
__ieee754_coshl (long double x)
|
||||
{
|
||||
fputs ("__ieee754_coshl not implemented\n", stderr);
|
||||
__set_errno (ENOSYS);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
stub_warning (__ieee754_coshl)
|
||||
#include <stub-tag.h>
|
14
sysdeps/generic/e_gammal_r.c
Normal file
14
sysdeps/generic/e_gammal_r.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
long double
|
||||
__ieee754_gammal_r (long double x, int *signgamp)
|
||||
{
|
||||
fputs ("__ieee754_gammal_r not implemented\n", stderr);
|
||||
__set_errno (ENOSYS);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
stub_warning (__ieee754_gammal_r)
|
||||
#include <stub-tag.h>
|
14
sysdeps/generic/e_hypotl.c
Normal file
14
sysdeps/generic/e_hypotl.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
long double
|
||||
__ieee754_hypotl (long double x, long double y)
|
||||
{
|
||||
fputs ("__ieee754_hypotl not implemented\n", stderr);
|
||||
__set_errno (ENOSYS);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
stub_warning (__ieee754_hypotl)
|
||||
#include <stub-tag.h>
|
14
sysdeps/generic/e_sinhl.c
Normal file
14
sysdeps/generic/e_sinhl.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
long double
|
||||
__ieee754_sinhl (long double x)
|
||||
{
|
||||
fputs ("__ieee754_sinhl not implemented\n", stderr);
|
||||
__set_errno (ENOSYS);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
stub_warning (__ieee754_sinhl)
|
||||
#include <stub-tag.h>
|
@ -1,32 +1 @@
|
||||
/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "gmp.h"
|
||||
#include "gmp-impl.h"
|
||||
|
||||
/* Convert a `long double' to a multi-precision integer representing the
|
||||
significand scaled up by the highest possible number of significant bits
|
||||
of fraction (LDBL_MANT_DIG), and an integral power of two (MPN frexpl). */
|
||||
|
||||
mp_size_t
|
||||
__mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
|
||||
int *expt, int *is_neg,
|
||||
double value)
|
||||
{
|
||||
#error "not implemented for this floating point format"
|
||||
}
|
||||
/* Empty. Not needed unless ldbl support is in. */
|
||||
|
5
sysdeps/generic/math_ldbl.h
Normal file
5
sysdeps/generic/math_ldbl.h
Normal file
@ -0,0 +1,5 @@
|
||||
#ifndef _MATH_PRIVATE_H
|
||||
#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
|
||||
#endif
|
||||
|
||||
/* This is empty. Any machine using long double type will override this header. */
|
@ -1,30 +1 @@
|
||||
/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "gmp.h"
|
||||
#include "gmp-impl.h"
|
||||
#include <float.h>
|
||||
|
||||
/* Convert a multi-precision integer of the needed number of bits and an
|
||||
integral power of two to a `long double'. */
|
||||
|
||||
long double
|
||||
__mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int negative)
|
||||
{
|
||||
#error "__mpn_construct_long_double not implemented for floating point format"
|
||||
}
|
||||
/* Empty. Not needed unless ldbl support is in. */
|
||||
|
@ -106,8 +106,8 @@ __printf_fphex (FILE *fp,
|
||||
const char *special = NULL;
|
||||
|
||||
/* Buffer for the generated number string for the mantissa. The
|
||||
maximal size for the mantissa is 64 bits. */
|
||||
char numbuf[16];
|
||||
maximal size for the mantissa is 128 bits. */
|
||||
char numbuf[32];
|
||||
char *numstr;
|
||||
char *numend;
|
||||
int negative;
|
||||
@ -229,8 +229,6 @@ __printf_fphex (FILE *fp,
|
||||
return done;
|
||||
}
|
||||
|
||||
/* We are handling here only 64 and 80 bit IEEE foating point
|
||||
numbers. */
|
||||
if (info->is_long_double == 0 || sizeof (double) == sizeof (long double))
|
||||
{
|
||||
/* We have 52 bits of mantissa plus one implicit digit. Since
|
||||
@ -281,64 +279,10 @@ __printf_fphex (FILE *fp,
|
||||
exponent = -(exponent - IEEE754_DOUBLE_BIAS);
|
||||
}
|
||||
}
|
||||
#ifdef PRINT_FPHEX_LONG_DOUBLE
|
||||
else
|
||||
{
|
||||
/* The "strange" 80 bit format on ix86 and m68k has an explicit
|
||||
leading digit in the 64 bit mantissa. */
|
||||
unsigned long long int num;
|
||||
|
||||
assert (sizeof (long double) == 12);
|
||||
|
||||
num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32
|
||||
| fpnum.ldbl.ieee.mantissa1);
|
||||
|
||||
zero_mantissa = num == 0;
|
||||
|
||||
if (sizeof (unsigned long int) > 6)
|
||||
numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
|
||||
info->spec == 'A');
|
||||
else
|
||||
numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A');
|
||||
|
||||
/* Fill with zeroes. */
|
||||
while (numstr > numbuf + (sizeof numbuf - 64 / 4))
|
||||
*--numstr = '0';
|
||||
|
||||
/* We use a full nibble for the leading digit. */
|
||||
leading = *numstr++;
|
||||
|
||||
/* We have 3 bits from the mantissa in the leading nibble.
|
||||
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */
|
||||
exponent = fpnum.ldbl.ieee.exponent;
|
||||
|
||||
if (exponent == 0)
|
||||
{
|
||||
if (zero_mantissa)
|
||||
expnegative = 0;
|
||||
else
|
||||
{
|
||||
/* This is a denormalized number. */
|
||||
expnegative = 1;
|
||||
/* This is a hook for the m68k long double format, where the
|
||||
exponent bias is the same for normalized and denormalized
|
||||
numbers. */
|
||||
#ifndef LONG_DOUBLE_DENORM_BIAS
|
||||
# define LONG_DOUBLE_DENORM_BIAS (IEEE854_LONG_DOUBLE_BIAS - 1)
|
||||
PRINT_FPHEX_LONG_DOUBLE;
|
||||
#endif
|
||||
exponent = LONG_DOUBLE_DENORM_BIAS + 3;
|
||||
}
|
||||
}
|
||||
else if (exponent >= IEEE854_LONG_DOUBLE_BIAS + 3)
|
||||
{
|
||||
expnegative = 0;
|
||||
exponent -= IEEE854_LONG_DOUBLE_BIAS + 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
expnegative = 1;
|
||||
exponent = -(exponent - (IEEE854_LONG_DOUBLE_BIAS + 3));
|
||||
}
|
||||
}
|
||||
|
||||
/* Look for trailing zeroes. */
|
||||
if (! zero_mantissa)
|
||||
|
15
sysdeps/generic/s_asinhl.c
Normal file
15
sysdeps/generic/s_asinhl.c
Normal file
@ -0,0 +1,15 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
long double
|
||||
__asinhl(long double x)
|
||||
{
|
||||
fputs ("__asinhl not implemented\n", stderr);
|
||||
__set_errno (ENOSYS);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
weak_alias (__asinhl, asinhl)
|
||||
stub_warning (asinhl)
|
||||
#include <stub-tag.h>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user