diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-11-04 23:45:45 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-11-04 23:45:45 +0000 |
commit | ff8ac38322d991429a64dd127173af99dee3d9ca (patch) | |
tree | 857c258a5ae7292290a9ebb8fefb531a21d9d169 | |
parent | 00c1176b65cc2961b094c3dd78dd53072eb61fe9 (diff) | |
download | glibc-ff8ac38322d991429a64dd127173af99dee3d9ca.tar glibc-ff8ac38322d991429a64dd127173af99dee3d9ca.tar.gz glibc-ff8ac38322d991429a64dd127173af99dee3d9ca.tar.bz2 glibc-ff8ac38322d991429a64dd127173af99dee3d9ca.zip |
Update.
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.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | elf/dlopenold.c | 4 | ||||
-rw-r--r-- | misc/efgcvt_r.c | 60 |
3 files changed, 31 insertions, 39 deletions
@@ -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> * elf/dlopenold.c: Compile only if DO_VERSIONING is also defined. diff --git a/elf/dlopenold.c b/elf/dlopenold.c index a9659ae3ec..49fce7a545 100644 --- a/elf/dlopenold.c +++ b/elf/dlopenold.c @@ -17,7 +17,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 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 <stddef.h> diff --git a/misc/efgcvt_r.c b/misc/efgcvt_r.c index 64dcfcd7e9..1c237eed4a 100644 --- a/misc/efgcvt_r.c +++ b/misc/efgcvt_r.c @@ -136,10 +136,6 @@ APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len) return 0; } -#define weak_extern2(name) weak_extern (name) -weak_extern2 (FLOOR) weak_extern2 (LOG10) weak_extern2 (FABS) -weak_extern2 (EXP) - int APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len) FLOAT_TYPE value; @@ -151,46 +147,34 @@ APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len) 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; - } + /* Slow code that doesn't require -lm functions. */ + FLOAT_TYPE d; + FLOAT_TYPE f = 1.0; + if (value < 0.0) + d = -value; else + d = value; + if (d < 1.0) { - /* Slow code that doesn't require -lm functions. */ - FLOAT_TYPE d; - if (value < 0.0) - d = -value; - else - d = value; - if (d < 1.0) + do { - do - { - d *= 10.0; - --exponent; - } - while (d < 1.0); + f *= 10.0; + --exponent; } - else if (d >= 10.0) + while (d * f < 1.0); + + value *= f; + } + else if (d >= 10.0) + { + do { - do - { - d *= 0.1; - ++exponent; - } - while (d >= 10.0); + f *= 10; + ++exponent; } - if (value < 0.0) - value = -d; - else - value = d; + while (d >= f * 10.0); + + value /= f; } } else if (value == 0.0) |