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/18245] New: sqrtl(1.1L) raises the inexact flag


https://sourceware.org/bugzilla/show_bug.cgi?id=18245

            Bug ID: 18245
           Summary: sqrtl(1.1L) raises the inexact flag
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: nszabolcs at gmail dot com

sqrt should not raise inexact when the result is nan.

the following code prints (x86_64 and aarch64 as well):
sqrtl(-1.1) = nan  invalid=1  inexact=1  want inexact=0


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

int main()
{
#pragma STDC FENV_ACCESS ON
long double x = -1.1L;
long double r;

feclearexcept(FE_ALL_EXCEPT);
r = sqrtl(x);
if (fetestexcept(FE_INEXACT))
        printf("sqrtl(%Lg) = %La  invalid=%d  inexact=%d  want inexact=0\n", x,
r, !!fetestexcept(FE_INVALID), !!fetestexcept(FE_INEXACT));
}

-- 
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]