[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-bugs
Subject:    [LLVMbugs] [Bug 216] NEW: floating-point unary minus is incorrect
From:       bugzilla-daemon () cs ! uiuc ! edu
Date:       2004-01-30 17:39:10
Message-ID: 200401301739.LAA03520 () zion ! cs ! uiuc ! edu
[Download RAW message or body]

http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=216

           Summary: floating-point unary minus is incorrect
           Product: tools
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: sabre@nondot.org
        ReportedBy: mkahl@apple.com


LLVM does not have unary operators, so unary minus is emulated as "0 - x".  This is \
not correct for IEEE  floating-point numbers.

In particular, the negation of "0.0" should be "-0.0", not "0.0", because positive \
and negative zeroes are  distinct in IEEE.  I will attach a test program that \
illustrates this difference.

I don't know whether LLVM's treatment is also incorrect for NaN's and Inf's...

On the PowerPC, this could be easily fixed by emulating floating-point unary minus as \
"-0.0 - x" (rather  than "+0.0 - x").  However, (a) I don't know whether this also \
works for NaN's and Inf's, and (b) I don't  know whether this works in general on \
other processors.

You may need to rethink the decision to omit true unary operators from the LLVM IR.

You could argue that IEEE floating-point is not a strict requirement of the C/C++ \
standards, but in  practice that is what people expect (and get, from gcc).



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic