all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andreas Enge <andreas@enge.fr>
To: Michael Schierl <schierlm@gmx.de>
Cc: guix-devel@gnu.org
Subject: Re: Procps in core-updates
Date: Mon, 20 Mar 2023 22:25:37 +0100	[thread overview]
Message-ID: <ZBjPUc/jDZ2ZH0yg@jurong> (raw)
In-Reply-To: <83194a1d-4589-aed9-09a3-5d1495d06699@gmx.de>

Am Mon, Mar 20, 2023 at 09:02:01PM +0100 schrieb Michael Schierl:
> Seems that you accidentally attached the object file (binary) instead of
> the assembly output. :-)

Hm, I had accidentally written the assembly output to a .o file, and then
apparently accidentally overwritten the file before attaching it :-(

> > The weirdest thing is that actually the value is the integer 123. So it
> > should be stored in any kind of register exactly.
> 123 as a normalized binary floating point number would be
> 1.921875 × 2⁶
> and you would have to represent the mantissa in binary (1.111011₂).
> Still this should fit into most floating point registers easily.

Exactly! 7 bits of mantissa would be enough.

> But possibly the value computed by the algorithm of parsing the number
> resulted in e.g.
> 1.111011000000000000000000000000000000000000000000000001011₂ × 2⁶

I looked at the algorithm, it uses a Horner scheme
((1*10)+2)*10+3, so everything should fit in every step and be fine.

I mentioned the problem to colleagues, who told me "this is the well-known
GCC bug 323":
   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323
And they pointed me to even crazier things, errors even after casting
floating point numbers to integers in cases where gcc "optimises" the code:
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102930
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85957
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93681
Enjoy the output
z = 0
z is one
coming from
    int z = opaque(1) + 0x1p-60 == 1;
    printf("z = %d\n", z);
    if (z)
        puts("z is one");
!
It looks like a quantum computer, z is a superposition of 0 and 1 :)

Andreas



  reply	other threads:[~2023-03-20 21:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-18 12:32 Procps in core-updates Andreas Enge
2023-03-18 17:38 ` Leo Famulari
2023-03-18 17:44   ` Andreas Enge
2023-03-19 17:36 ` Michael Schierl
2023-03-20 14:54   ` Andreas Enge
2023-03-20 20:02     ` Michael Schierl
2023-03-20 21:25       ` Andreas Enge [this message]
2023-03-19 17:49 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2023-03-19 19:22   ` Kaelyn

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=ZBjPUc/jDZ2ZH0yg@jurong \
    --to=andreas@enge.fr \
    --cc=guix-devel@gnu.org \
    --cc=schierlm@gmx.de \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.