This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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] Fix for logb/logbf/logbl (bz 13954/13955/13956)


On 05/25/2012 01:20 PM, Adhemerval Zanella wrote:
> On 05/25/2012 09:56 AM, Andreas Schwab wrote:
>
> diff --git a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
> index 678b6ca..9b0bd98 100644
> --- a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
> +++ b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
> @@ -38,10 +38,12 @@ __logbl (long double x)
>      {
>        /* POSIX specifies that denormal number is treated as
>           though it were normalized.  */
> -      int m1 = (hx == 0) ? 0 : __builtin_clzll (hx);
> -      int m2 = (lx == 0) ? 0 : __builtin_clzll (lx);
> -      int ma = (m1 == 0) ? m2 + 64 : m1;
> -      return -1022.0 + (long double)(11 - ma);
> +      int ma;
> +      if (hx == 0)
> +	ma = __builtin_clzll (lx) + 64;
> +      else
> +	ma = __builtin_clzll (hx);
> +      rhx -= ma - 12;
>      }
>    return (long double) (rhx - 1023);
>  }
>
Based on your previous email I think only 'hx' should be considered as:

+      int ma = (hx == 0) ? 0 : __builtin_clzll (hx);
+      rhx -= ma - 12;

-- 
Adhemerval Zanella Netto
  Software Engineer
  Linux Technology Center Brazil
  Toolchain / GLIBC on Power Architecture
  azanella@linux.vnet.ibm.com / azanella@br.ibm.com
  +55 61 8642-9890


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