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

Re: 80-bit subnormals printed incorrectly on Debian 11 M68K



In article <CMM.0.95.0.1626875139.beebe@gamma.math.utah.edu>,
  Nelson H. F. Beebe <beebe@math.utah.edu> wrote:

> I run a large farm of physical and virtual machines that we use for
> software testing.  We have multiple versions of most of the major
> operating systems, covering the major CPU families of the past 30
> years, including M68K.

> In testing some numerical software on Debian 11 on M68k (emulated by
> QEMU 4.2.1), I discovered that 80-bit subnormals are printed
> incorrectly: they are exactly HALF their correct values.

> A test program is provided below, and a snippet of its identical and
> correct output on x86_64 and IA-64 (Itanium) physical hardware looks
> like this around the transition from tiny normal numbers to subnormal
> numbers:

>     k = -16380  x = 0x8.0000000000000000p-16383 = 1.344841257244837403e-4931 = 0x0003_80000000_00000000
>     k = -16381  x = 0x8.0000000000000000p-16384 = 6.724206286224187013e-4932 = 0x0002_80000000_00000000
>     k = -16382  x = 0x8.0000000000000000p-16385 = 3.362103143112093506e-4932 = 0x0001_80000000_00000000

>     ---------- begin subnormals ----------

>     k = -16383  x = 0x4.0000000000000000p-16385 = 1.681051571556046753e-4932 = 0x0000_40000000_00000000
>     k = -16384  x = 0x2.0000000000000000p-16385 = 8.405257857780233766e-4933 = 0x0000_20000000_00000000
>     k = -16385  x = 0x1.0000000000000000p-16385 = 4.202628928890116883e-4933 = 0x0000_10000000_00000000

> Here is the output from Debian 11 on M68k (identical with both gcc-9
> and gcc-10):

>     k = -16380  x = 0x8.0000000000000000p-16383 = 1.344841257244837403e-4931 = 0x0003_80000000_00000000
>     k = -16381  x = 0x8.0000000000000000p-16384 = 6.724206286224187013e-4932 = 0x0002_80000000_00000000
>     k = -16382  x = 0x8.0000000000000000p-16385 = 3.362103143112093506e-4932 = 0x0001_80000000_00000000

>     ---------- begin subnormals ----------

>     k = -16383  x = 0x4.0000000000000000p-16386 = 8.405257857780233766e-4933 = 0x0000_40000000_00000000

Here, the number has been divided by 4 instead of 2. The printf output
is correct. This is a QEMU bug in the multiplication with subnormals.
See the discussion in the MPFR mailing-list:
  https://sympa.inria.fr/sympa/arc/mpfr/2022-12/msg00036.html

-- 
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 to: