Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update.
  • Loading branch information
Ulrich Drepper committed Jul 14, 1999
1 parent 86421aa commit abfbdde
Show file tree
Hide file tree
Showing 587 changed files with 5,286 additions and 339 deletions.
1,127 changes: 1,127 additions & 0 deletions ChangeLog

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions math/machine/endian.h

This file was deleted.

99 changes: 3 additions & 96 deletions math/math_private.h
Expand Up @@ -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:
Expand Down Expand Up @@ -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));
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 22 additions & 3 deletions stdio-common/printf_fp.c
Expand Up @@ -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
{
Expand Down
5 changes: 3 additions & 2 deletions sysdeps/alpha/Implies
@@ -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
3 changes: 2 additions & 1 deletion sysdeps/arm/Implies
@@ -1,2 +1,3 @@
wordsize-32
ieee754
ieee754/flt-32
ieee754/dbl-64
14 changes: 14 additions & 0 deletions sysdeps/generic/e_atanhl.c
@@ -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 changes: 14 additions & 0 deletions sysdeps/generic/e_coshl.c
@@ -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>
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions sysdeps/generic/e_gammal_r.c
@@ -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 changes: 14 additions & 0 deletions sysdeps/generic/e_hypotl.c
@@ -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>
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions sysdeps/generic/e_sinhl.c
@@ -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>
33 changes: 1 addition & 32 deletions sysdeps/generic/ldbl2mpn.c
@@ -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 changes: 5 additions & 0 deletions sysdeps/generic/math_ldbl.h
@@ -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. */
31 changes: 1 addition & 30 deletions sysdeps/generic/mpn2ldbl.c
@@ -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. */
64 changes: 4 additions & 60 deletions sysdeps/generic/printf_fphex.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit abfbdde

Please sign in to comment.