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

            Bug ID: 46802
           Summary: ARM long double arithmetic done wrong
           Product: clang
           Version: 10.0
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangb...@nondot.org
          Reporter: tyde...@tybor.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

/*
 * Signed zero long double bug.  All output should be +inf.
 */

#include <fenv.h>
#include <stdio.h>

static long double ld_P0 = +0.L;
static long double ld_M0 = -0.L;
static long double ld_pone = +1.L;

int main(void){
  long double ld23;
  int rnd_rc;

  (void)printf("ld_M0=%Lg, ld_pone=%Lg\n", ld_M0, ld_pone);

  ld23 = ld_P0 + ld_P0*ld_pone;
  (void)printf("1/ld23=%Lg\n", 1.L/ld23);

  ld23 = -ld_M0 - ld_M0*ld_pone;
  (void)printf("1/ld23=%Lg\n", 1.L/ld23);

  rnd_rc = fesetround( FE_DOWNWARD );
  ld23 = ld_P0 + ld_P0*ld_pone;
  (void)printf("1/ld23=%Lg\n", 1.L/ld23);

  ld23 = -ld_M0 - ld_M0*ld_pone;        /* bug */
  (void)printf("1/ld23=%Lg\n", 1.L/ld23);

  return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to