[LLVMbugs] [Bug 5044] New: sqrt(-1.0) = 0

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Sep 24 14:40:58 PDT 2009


           Summary: sqrt(-1.0) = 0
           Product: new-bugs
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: alexmac at adobe.com
                CC: llvmbugs at cs.uiuc.edu, alexmac at adobe.com

Created an attachment (id=3555)
 --> (http://llvm.org/bugs/attachment.cgi?id=3555)
svn diff output

When called indirectly the sqrt function returns 0 for an input of -1.0 rather
than NAN. compiling the following program with llvm-gcc -O3 demonstrates the

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

double mysqrt(double x) {
    return sqrt(x);

int main() {
    printf("sqrt(-1) == %G\n", mysqrt(-1.0));

A fix for the bug is attached

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

More information about the llvm-bugs mailing list