[llvm-bugs] [Bug 47082] New: Avoid doing equality comparisons between floating expressions.(llvm-project/llvm/tools/llvm-xray/xray-color-helper.cpp:line 98 and 105)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 10 00:17:35 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47082

            Bug ID: 47082
           Summary: Avoid doing equality comparisons between floating
                    expressions.(llvm-project/llvm/tools/llvm-xray/xray-co
                    lor-helper.cpp:line 98 and 105)
           Product: tools
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: llvmc
          Assignee: unassignedbugs at nondot.org
          Reporter: info at ustchcs.com
                CC: llvm-bugs at lists.llvm.org

Avoid doing equality comparisons between floating expressions.

commit e3546c78cabfbf670391a57766872f0a8e28a423

llvm-project/llvm/tools/llvm-xray/xray-color-helper.cpp:line 98 and 105

    95    double C = Scaled[Max] - Scaled[Min];
    96  
    97    double HPrime =
    98        (C == 0) ? 0 : (Scaled[(Max + 1) % 3] - Scaled[(Max + 2) % 3]) /
C;
    99    HPrime = HPrime + 2.0 * Max;
   100  
   101    double H = (HPrime < 0) ? (HPrime + 6.0) * 60
   102                            : HPrime * 60; // Scale to between 0 and 360
   103    double V = Scaled[Max];
   104  
   105    double S = (V == 0.0) ? 0.0 : C / V;
   106  
   107    return std::make_tuple(H, S, V);
   108  }


Reported by: Ustchcs Toolsets Bugfinder
(bugfinder-5.15: Avoid doing equality comparisons between floating
expressions.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200810/8ea56c74/attachment.html>


More information about the llvm-bugs mailing list