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] PowerPC - logb[f|l] optimization for POWER7


On 05/25/2012 10:17 AM, Andreas Schwab wrote:
> Adhemerval Zanella <azanella@linux.vnet.ibm.com> writes:
>
>> +  else if (__builtin_expect (ret == two10m1, 0))
>> +    {
>> +      int64_t lx, hx;
>> +      int m1, m2, ma;
>> +
>> +      GET_LDOUBLE_WORDS64 (hx, lx, x);
>> +      m1 = (hx == 0) ? 0 : __builtin_clzll (hx);
>> +      m2 = (lx == 0) ? 0 : __builtin_clzll (lx);
>> +      ma = (m1 == 0) ? m2 + 64 : m1;
>> +      return -1022.0 + (double)(11 - ma);
> That doesn't look correct.  The upper double only provides 53 bits of
> the full mantissa.  On the other hand, if hx is zero, doesn't that mean
> that the whole number is zero?
>
> Andreas.
>
You are correct, if 'hx' is zero the long double number in fact 0.0L (although one can still
craft a number like [0.0,1.0] but I presume it is not a normal long double usage).

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