1998-11-04  Ulrich Drepper  <drepper@cygnus.com>

	* misc/efgcvt_r.c (fcvt_r): Remove code which tries to use libm
	functions.  Reduce error in computing normalized value by multiplying
	factor in loop and compute result in one step.
This commit is contained in:
Ulrich Drepper 1998-11-04 23:45:45 +00:00
parent 00c1176b65
commit ff8ac38322
3 changed files with 31 additions and 39 deletions

View File

@ -1,3 +1,9 @@
1998-11-04 Ulrich Drepper <drepper@cygnus.com>
* misc/efgcvt_r.c (fcvt_r): Remove code which tries to use libm
functions. Reduce error in computing normalized value by multiplying
factor in loop and compute result in one step.
1998-11-04 Andreas Jaeger <aj@arthur.rhein-neckar.de> 1998-11-04 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* elf/dlopenold.c: Compile only if DO_VERSIONING is also defined. * elf/dlopenold.c: Compile only if DO_VERSIONING is also defined.

View File

@ -17,7 +17,9 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifdef PIC /* This file is for compatibility with glibc 2.0. Compile it only if
versioning is used. */
#if defined PIC && DO_VERSIONING
#include <dlfcn.h> #include <dlfcn.h>
#include <stddef.h> #include <stddef.h>

View File

@ -136,10 +136,6 @@ APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
return 0; return 0;
} }
#define weak_extern2(name) weak_extern (name)
weak_extern2 (FLOOR) weak_extern2 (LOG10) weak_extern2 (FABS)
weak_extern2 (EXP)
int int
APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len) APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
FLOAT_TYPE value; FLOAT_TYPE value;
@ -150,21 +146,10 @@ APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
int exponent = 0; int exponent = 0;
if (isfinite (value) && value != 0.0) if (isfinite (value) && value != 0.0)
{
FLOAT_TYPE (*log10_function) (FLOAT_TYPE) = &LOG10;
if (log10_function)
{
/* Use the reasonable code if -lm is included. */
FLOAT_TYPE dexponent;
dexponent = FLOOR (LOG10 (FABS (value)));
value *= EXP (dexponent * -M_LN10);
exponent = (int) dexponent;
}
else
{ {
/* Slow code that doesn't require -lm functions. */ /* Slow code that doesn't require -lm functions. */
FLOAT_TYPE d; FLOAT_TYPE d;
FLOAT_TYPE f = 1.0;
if (value < 0.0) if (value < 0.0)
d = -value; d = -value;
else else
@ -173,24 +158,23 @@ APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
{ {
do do
{ {
d *= 10.0; f *= 10.0;
--exponent; --exponent;
} }
while (d < 1.0); while (d * f < 1.0);
value *= f;
} }
else if (d >= 10.0) else if (d >= 10.0)
{ {
do do
{ {
d *= 0.1; f *= 10;
++exponent; ++exponent;
} }
while (d >= 10.0); while (d >= f * 10.0);
}
if (value < 0.0) value /= f;
value = -d;
else
value = d;
} }
} }
else if (value == 0.0) else if (value == 0.0)