Bug 11451 - atan2 leaves overflow bit set in status register
Summary: atan2 leaves overflow bit set in status register
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: 2.10
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-30 14:48 UTC by Geoff Streeter
Modified: 2014-06-30 18:20 UTC (History)
1 user (show)

See Also:
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Build: x86_64-linux-gnu
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Geoff Streeter 2010-03-30 14:48:14 UTC
eglibc-2.10.1/sysdeps/ieee754/dbl-64
e_tan2.c line: 406 calls
EMULV in dla.h which overflows

test case
#include <stdio.h>
#include <math.h>
#include <float.h>
#include <fenv.h>

double call_atan2(double x, double y)
        {
        volatile double a = x;
        volatile double b = y;
        volatile double r = atan2(x, y);

        return r;
        }

int main(void)
        {
        double piby4 = call_atan2(DBL_MAX, DBL_MAX);
        fexcept_t fe = fetestexcept(FE_OVERFLOW);
        char *word = fe ? "overflowed" : "";

        printf("atan2(%e, %e) => %e %s\n", DBL_MAX, DBL_MAX, piby4, word);
        return 0;
        }
Comment 1 Joseph Myers 2012-03-06 21:04:38 UTC
Confirmed with current sources on x86_64.
Comment 2 Joseph Myers 2012-03-19 20:18:28 UTC
Fixed (both OVERFLOW and INVALID exceptions were wrongly given) by:

commit 7726d6a95d5a2c08c8d43186002f040b9b889c27
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Mon Mar 19 20:11:09 2012 +0000

    Fix atan2 spurious exceptions (bug 11451).