public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vincent-gcc at vinc17 dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/26374] Compile failure on long double
Date: Tue, 08 Mar 2022 23:17:21 +0000	[thread overview]
Message-ID: <bug-26374-4-a4jKLUVte1@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-26374-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26374

--- Comment #21 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Jakub Jelinek from comment #16)
> As for constant folding, even with double double gcc is able to fold some
> constant arithmetics in that format, but because the emulation is only
> approximate (it pretends it is 106-bit precision format while in reality it
> is variable precision up to some thousands depending on the exact values).
> As has been said elsewhere, the emulation would be implementable if gcc
> handled double double in all the arithmetics as a pair of doubles with all
> the rules for it.  But e.g. mpfr/libmpc isn't able to do something like
> that, so we'd need to compute everything with much bigger precision etc.

Well, the C standard does not require correct rounding, and while correct
rounding is important for the IEEE formats, it is rather useless for the
double-double format, whose goal was just to provide more precision than
double, but still be rather fast (compared to quad emulation). The main
drawback would be that results could be different whether a FP expression is
evaluated at run time or at compile time, but unless users seek to control
everything (e.g. with IEEE formats), they should get use to that (FYI, you can
have the same kind of issues with the contraction of FP expressions, such as
FMA generation from mul-add, which GCC enable by default). So, in short, doing
the compile-time evaluation at a 106-bit precision or more would be acceptable
IMHO, at least better than a compiler error.

Note: Even though double-double can be very interesting as a compromise between
performance and accuracy, there exist various algorithms and which algorithm
should be chosen depends on the context, which only the author of the program
can know in general. Thus it was a bad idea to implement double-double as a
native FP type (here, long double); instead, the selection of the algorithms
should be left to the developer. So the switch to IEEE quad is a good thing.
But for how long will old ABIs be around?

  parent reply	other threads:[~2022-03-08 23:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-26374-4@http.gcc.gnu.org/bugzilla/>
2014-02-16 13:12 ` jackie.rosen at hushmail dot com
2022-03-08 18:36 ` beebe at math dot utah.edu
2022-03-08 18:43 ` pinskia at gcc dot gnu.org
2022-03-08 20:22 ` jakub at gcc dot gnu.org
2022-03-08 20:40 ` beebe at math dot utah.edu
2022-03-08 20:45 ` jakub at gcc dot gnu.org
2022-03-08 21:04 ` beebe at math dot utah.edu
2022-03-08 21:12 ` dje at gcc dot gnu.org
2022-03-08 23:17 ` vincent-gcc at vinc17 dot net [this message]
2022-03-11 17:35 ` beebe at math dot utah.edu
2006-02-19 21:59 [Bug target/26374] New: " mueller at gcc dot gnu dot org
2006-02-20 19:33 ` [Bug middle-end/26374] " pinskia at gcc dot gnu dot org
2006-02-24 21:07 ` pinskia at gcc dot gnu dot org
2006-04-06 16:14 ` pinskia at gcc dot gnu dot org
2006-12-28 14:32 ` dwmw2 at infradead dot org
2006-12-28 14:48 ` pinskia at gcc dot gnu dot org
2007-03-22 23:50 ` pinskia at gcc dot gnu dot org

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=bug-26374-4-a4jKLUVte1@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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 read-only IMAP folder(s) and NNTP newsgroup(s).