From: Laurent Vivier <laurent@vivier.eu>
To: Keith Packard <keithp@keithp.com>,
qemu-devel@nongnu.org,
Richard Henderson <richard.henderson@linaro.org>
Subject: Re: Funny results with long double denorms on m68k
Date: Mon, 21 Aug 2023 10:34:38 +0200 [thread overview]
Message-ID: <75b13a6f-5866-4948-00fb-fbfdb7866e3d@vivier.eu> (raw)
In-Reply-To: <87bkf1l9hf.fsf@keithp.com>
Le 20/08/2023 à 22:55, Keith Packard a écrit :
> #include <stdio.h>
> #include <stdint.h>
>
> #define X 0x1p+16383l
> #define Y 0x1p-16446l
>
> static long double build_mul = X * Y;
> static volatile long double x = X;
> static volatile long double y = Y;
>
> static void
> dump_ld(const char *label, long double ld)
> {
> union {
> long double d;
> struct {
> uint32_t exp:16;
> uint32_t space:16;
> uint32_t h;
> uint32_t l;
> };
> } u;
>
> u.d = ld;
> printf("%12s: % -27La 0x%04x 0x%08x 0x%08x\n", label, u.d, u.exp, u.h, u.l);
> }
>
> int main(void)
> {
> long double runtime_mul = x * y;
>
> dump_ld("x", x);
> dump_ld("y", y);
> dump_ld("build_mul", build_mul);
> dump_ld("runtime_mul", runtime_mul);
> return 0;
> }
FYI, result of this program on a real hardware (q800/m68040) is:
x: 0x8p+16380 0x7ffe 0x80000000 0x00000000
y: 0x0.000000000000001p-16386 0x0000 0x00000000 0x00000001
build_mul: 0x8p-66 0x3fc0 0x80000000 0x00000000
runtime_mul: 0x8p-66 0x3fc0 0x80000000 0x00000000
Thanks,
Laurent
next prev parent reply other threads:[~2023-08-21 8:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-20 20:55 Funny results with long double denorms on m68k Keith Packard via
2023-08-21 8:34 ` Laurent Vivier [this message]
2023-08-21 10:07 ` Laurent Vivier
2023-08-21 15:58 ` Keith Packard via
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=75b13a6f-5866-4948-00fb-fbfdb7866e3d@vivier.eu \
--to=laurent@vivier.eu \
--cc=keithp@keithp.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).