This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gdb/doublest.c: Avoid calling ldfrexp if long double is double.


> 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
> 
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]