Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: will.newton@linaro.org
Cc: gdb-patches@sourceware.org, patches@linaro.org
Subject: Re: [PATCH] gdb/doublest.c: Avoid calling ldfrexp if long double is double.
Date: Fri, 07 Jun 2013 20:24:00 -0000	[thread overview]
Message-ID: <201306072009.r57K9kiX009408@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <51B228C9.2030105@linaro.org> (message from Will Newton on Fri,	07 Jun 2013 19:39:05 +0100)

> Date: Fri, 07 Jun 2013 19:39:05 +0100
> From: Will Newton <will.newton@linaro.org>
> 
> There's no need to call ldfrexp if long double is the same size
> as double, the standard frexp will be faster and more accurate.
> This fixes a failure in ldbl_308.exp on ARM, where long double
> is the same size as double.
> 
> gdb/ChangeLog:
> 
> 2013-06-07  Will Newton  <will.newton@linaro.org>
> 
> 	* doublest.c (convert_doublest_to_floatformat): If long
> 	double is the same size as double call frexp instead of
> 	ldfrexp.
> ---
>  gdb/doublest.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Hmm, sounds like the real bug is in ldfrexp.  Not sure if that is
fixable though.  How many systems are still out there that have a long
double type, but don't have frexpl(3)?

Hmm, according to

  <http://www.gnu.org/software/gnulib/manual/html_node/frexpl.html>

there might still be a few.  But that means we just have to include
another gnulib module ;).

> diff --git a/gdb/doublest.c b/gdb/doublest.c
> index 9ddc7a6..4bc0bd6 100644
> --- a/gdb/doublest.c
> +++ b/gdb/doublest.c
> @@ -466,7 +466,10 @@ convert_doublest_to_floatformat (CONST struct floatformat *fmt,
>      }
> 
>  #ifdef HAVE_LONG_DOUBLE
> -  mant = ldfrexp (dfrom, &exponent);
> +  if (sizeof (long double) > sizeof (double))
> +    mant = ldfrexp (dfrom, &exponent);
> +  else
> +    mant = frexp (dfrom, &exponent);
>  #else
>    mant = frexp (dfrom, &exponent);
>  #endif
> -- 
> 1.8.1.4
> 
> 


  parent reply	other threads:[~2013-06-07 20:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-07 18:40 Will Newton
2013-06-07 18:39 ` Will Newton
2013-06-07 20:24 ` Mark Kettenis [this message]
2013-06-11 13:33   ` Will Newton

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=201306072009.r57K9kiX009408@glazunov.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=gdb-patches@sourceware.org \
    --cc=patches@linaro.org \
    --cc=will.newton@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