[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ieee754/dbl-64 bug in V2.2.4

From: Marius Groeger
Subject: ieee754/dbl-64 bug in V2.2.4
Date: Fri, 26 Oct 2001 17:11:09 +0200 (CEST)


we've encountered erratic behavior in the ieee754 code. We're using
gcc version 2.95.3 20010315 (release) to compile. glibc was configured
with the following options:



The log(), sin() and cos() functions hangs in an infinite loop down in
sysdeps/ieee754/dbl-64/mpa.c::norm():141-142. The bug shows up only
under special circumstances, apparently when certain rounding errors
have accumulated. I was able to reproduce the error with the following

#include <stdio.h>
#include <math.h>

union num {
    unsigned int i[2];
    double d;

int main(void)
    double j;
    union num x;

    /* this is +1.8432000000000004 times 2 to the -10 or 0.18 */
    x.i[1] = 0x3f5d7dbf;
    x.i[0] = 0x487fcb94;

    printf("cos(%g) = ", x.d);
    j = cos(x.d);
    printf("%g\n", j);

    return 0;

If you can't reproduce the bug with this, try:

double j,i;
for(i = 0.0; ; i += 0.0001)
    printf("cos(%g) = ", i);
    j = cos(i);
    printf("%g\n", j);

Thanks for any help you can spare!

Marius Groeger           SYSGO Real-Time Solutions GmbH     address@hidden
Software Engineering     Embedded and Real-Time Software    www.sysgo.de
Voice: +49-6136-9948-0   Am Pfaffenstein 14                 www.osek.de
FAX:   +49-6136-9948-10  55270 Klein-Winternheim, Germany   www.elinos.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]