public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Achim Gratz <Stromeko@nexgo.de>
To: cygwin@cygwin.com
Subject: Re: gcc 11.1.0: printf("%.43f\n", 0x1.52f8a8e32e982p-140): printed value is incorrectly rounded
Date: Sun, 13 Jun 2021 11:42:38 +0200	[thread overview]
Message-ID: <87o8caumlt.fsf@Rainer.invalid> (raw)
In-Reply-To: <CAL9Mx1uMOz2wfqbMpD_xfA=D9JkpFzVz6AR_DKHK34AvrGOP6w@mail.gmail.com> (Pavel M. via Cygwin's message of "Sat, 12 Jun 2021 23:45:54 +0300")

Pavel M via Cygwin writes:
> Sample code (t903.c):
> #include <stdio.h>
> int main(void)
> {
>     printf("%.43f\n", 0x1.52f8a8e32e982p-140);
>     return 0;
> }
>
> Invocations:
> # gcc on Windows 10 (Cygwin)
> $ gcc t903.c -Wall -Wextra -std=c11 -pedantic -Wfatal-errors && ./a.exe
> 0.0000000000000000000000000000000000000000010

You will want to report this against newlib, I'd think.  If I remember
correctly, newlib uses a single guard digit for the conversion and for
such an algorithm the result you see is expected and correct.  Whether
any later C standard would mandate to use an algorithm that uses higher
precision (in terms of guard digits you'd end up with 15 for your
example before you get the expected result I think) I have no idea.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf rackAttack V1.04R1:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

  reply	other threads:[~2021-06-13  9:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-12 20:45 Pavel M
2021-06-13  9:42 ` Achim Gratz [this message]
2021-06-13 19:19 ` Brian Inglis
2021-11-03 21:07 ` Pavel M
2021-11-03 21:09   ` Pavel M
     [not found] ` <CAL9Mx1utCxXFPy3vOK0ZOkX2qzt8ntQ0LEyD4WvLpCRRbTLYeQ@mail.gmail.com>
2021-11-03 21:32   ` Pavel M

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=87o8caumlt.fsf@Rainer.invalid \
    --to=stromeko@nexgo.de \
    --cc=cygwin@cygwin.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).