tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] aarch64: subnormal double to long double conversion bug


From: Vincent Lefevre
Subject: [Tinycc-devel] aarch64: subnormal double to long double conversion bug
Date: Wed, 15 Jul 2020 16:05:53 +0200
User-agent: Mutt/1.14.5+76 (bb407ec3) vl-127292 (2020-06-24)

With TCC mob on aarch64, the double to long double conversion
is buggy on subnormal values. This makes a MPFR test fail
(reported by Christian Jullien).

Testcase:

#include <stdio.h>

int main (void)
{
  volatile double d = 0x0.88p-1022;  /* subnormal */
  printf ("d = %a\n", d);
  printf ("d = %.40g\n", d);
  volatile long double x = d;
  printf ("x = %La\n", x);
  printf ("x = %.40Lg\n", x);
  return 0;
}

With GCC (correct):

d = 0x0.88p-1022
d = 1.182070487331950734766686131082839659116e-308
x = 0x1.1p-1023
x = 1.182070487331950734766686131082839659116e-308

With TCC (incorrect):

d = 0x0.88p-1022
d = 1.182070487331950734766686131082839659116e-308
x = 0x1.88p-1023
x = 1.703572172919576058928459424207621861668e-308

I suspect that the code adds the usual implicit bit 1, but there is
no such bit with subnormals.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]