This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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 libgcc/78576] New: [PPC] wrong long double to long int conversion


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78576

            Bug ID: 78576
           Summary: [PPC] wrong long double to long int conversion
           Product: gcc
           Version: 6.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: brenohl at br dot ibm.com
  Target Milestone: ---

On ppc64le environment, I am facing an wrong conversion between long double and
long int.

This is my test case, which prints 27 instead of 26.

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

int main (){
        long double a = 3;
        long double b = 3;

        long c = powl(a,b);
        printf("%d\n", c);


}

It does not seem to be a rounding issue, since fesetround() is not affecting
the result.

I also changed the optimization levels, and it is not affecting the result.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]