This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/14478] New: cexpf: missing underflow exception


http://sourceware.org/bugzilla/show_bug.cgi?id=14478

             Bug #: 14478
           Summary: cexpf: missing underflow exception
           Product: glibc
           Version: 2.17
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: unassigned@sourceware.org
        ReportedBy: liubov.dmitrieva@gmail.com
    Classification: Unclassified


Test case:

// gcc main.c -std=c99 -lm
#include <stdio.h>
#include <math.h>
#include <complex.h>
#include <fenv.h>

int main() {
    float  _Complex a,b,r1;
    double _Complex r2;

    a=0x1p-50 + I * 0x1p-120; //argument

    fesetround(FE_TONEAREST);

    feclearexcept(FE_UNDERFLOW);
    r1 = cexpf(a);  //actual result
    if(fetestexcept(FE_UNDERFLOW)) 
        printf("PASSED: underfloaw occured.\n"); 
    else 
        printf("FAILED: underfloaw not occured.\n");
    r2 = cexp(a);   //actual result 2

    printf("inputs: a = %15.6a + I * %15.6a\n", creal(a), cimag(a));
    printf("actual    = %15.6a + I * %15.6a\n", creal(r1),cimag(r1));
    printf("expected  = %15.6a + I * %15.6a\n", creal(r2),cimag(r2));
    printf("error     = %15f + I * %15f ulp\n", 
        fabs(creal(r1) - creal(r2)) * exp2(23.0-logbf(creal(r1))),
        fabs(cimag(r1) - cimag(r2)) * exp2(23.0-logbf(cimag(r1))) );
    return 0;
}

Result x86_64:


FAILED: underfloaw not occured.
inputs: a =  0x1.000000p-50 + I * 0x1.000000p-120
actual    =   0x1.000000p+0 + I * 0x1.000000p-120
expected  =   0x1.000000p+0 + I * 0x1.000000p-120
error     =   0.000000 + I * 0.000000 ulp

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]