<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Wrong results from floor() on arm"
   href="https://bugs.llvm.org/show_bug.cgi?id=34530">34530</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong results from floor() on arm
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>raj.khem@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This testcase

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

int main(void)
{
   double test = 526457263.914274;
   double test2 = 526457263.000000;

   printf("orig=%f floor=%f\n", test, floor(test));
   printf("orig=%f floor=%f\n", test2, floor(test2));

   return 0;
}

runtime results on arm are wrong when -On option is not used.

root@raspberrypi3:~# ./a.out 
orig=526457263.914274 floor=526457088.000052
orig=526457263.000000 floor=0.000000

if I compile it with -Os or -O2 then results are correct

root@raspberrypi3:~# ./a.out 
orig=526457263.914274 floor=526457263.000000
orig=526457263.000000 floor=526457263.000000


This is a regression starting 4.0, it works fine with 3.7</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>