From owner-freebsd-numerics@FreeBSD.ORG Thu Dec 5 19:07:03 2013 Return-Path: Delivered-To: freebsd-numerics@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6E02B58D for ; Thu, 5 Dec 2013 19:07:03 +0000 (UTC) Received: from mail-pb0-x22a.google.com (mail-pb0-x22a.google.com [IPv6:2607:f8b0:400e:c01::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 43A061436 for ; Thu, 5 Dec 2013 19:07:03 +0000 (UTC) Received: by mail-pb0-f42.google.com with SMTP id uo5so26716675pbc.1 for ; Thu, 05 Dec 2013 11:07:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=8MMGfgT+QboKsBWjYJ69xdpKAI/ADW4b2OcY13Mou5E=; b=Z2mDWR2Lwj+Cm+ME+x+bA1crJ78WWffrRcACRUYZbJcYit+rWbam4u7aPaSk9o9c2+ a86btcRQx4blkeeRHE8OGIzPivxgfdy2cKynUCBEyqeeUpcHkensK3XnJwGkcLpMQ+y5 3MxHGJqpyLtfNnNykq8TzjHhk18FMQIdS7xIaCxKPVv+1inI+//OtkQkW9BcHoaVE6Uf 0NfPVdcuClwvYz17f/eIFUMjESbHAquX2JKm6crNh8PS43CmpJhRNR5W/l5AvFMSl5BL GV1GBGO2yncoAUeMHWag3jBlZeK203vT1Bz7eUDDWazwSf9wRFGkyz0mdGUfJbXgEq+0 e6hg== X-Received: by 10.66.254.200 with SMTP id ak8mr33801804pad.24.1386270422708; Thu, 05 Dec 2013 11:07:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.70.34.235 with HTTP; Thu, 5 Dec 2013 11:06:22 -0800 (PST) In-Reply-To: <20131205182324.GA65135@troutmask.apl.washington.edu> References: <20131205173700.GA64575@troutmask.apl.washington.edu> <20131205182324.GA65135@troutmask.apl.washington.edu> From: Filipe Maia Date: Thu, 5 Dec 2013 20:06:22 +0100 Message-ID: Subject: Re: dead code in lgamma_r[f]? To: Steve Kargl , freebsd-numerics@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.17 X-BeenThere: freebsd-numerics@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Discussions of high quality implementation of libm functions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2013 19:07:03 -0000 What if ix == 0x433xxxxx? Wouldn't the if clause be false? On Thu, Dec 5, 2013 at 7:23 PM, Steve Kargl < sgk@troutmask.apl.washington.edu> wrote: > On Thu, Dec 05, 2013 at 09:37:00AM -0800, Steve Kargl wrote: > > In reviewing the implementation details for lgamma_r[f], > > I noticed that in src/e_lgamma.c (and similar code in > > e_lgammaf.c): > > These should be e_lgamma_r.c and e_lgammaf_r.c. > I've only done some limited testing, but the > patch following my sig seems to work. > > Note the first part of the diff allows us to remove the > cast to float in e_lgamma_r.c, which minimizes the diff > between e_lgamma_r.c and e_lgammaf_r.c (and e_lgammal_r.c :). > > -- > Steve > > Index: src/e_lgamma_r.c > =================================================================== > --- src/e_lgamma_r.c (revision 1427) > +++ src/e_lgamma_r.c (working copy) > @@ -173,19 +173,15 @@ > */ > z = floor(y); > if(z!=y) { /* inexact anyway */ > - y *= 0.5; > - y = 2.0*(y - floor(y)); /* y = |x| mod 2.0 */ > - n = (int) (y*4.0); > + y /= 2; > + y = 2*(y - floor(y)); /* y = |x| mod 2.0 */ > + n = (int)(y*4); > } else { > - if(ix>=0x43400000) { > - y = zero; n = 0; /* y must be even */ > - } else { > - if(ix<0x43300000) z = y+two52; /* exact */ > - GET_LOW_WORD(n,z); > - n &= 1; > - y = n; > - n<<= 2; > - } > + z = y+two52; /* exact */ > + GET_LOW_WORD(n,z); > + n &= 1; > + y = n; > + n<<= 2; > } > switch (n) { > case 0: y = __kernel_sin(pi*y,zero,0); break; > Index: src/e_lgammaf_r.c > =================================================================== > --- src/e_lgammaf_r.c (revision 1427) > +++ src/e_lgammaf_r.c (working copy) > @@ -106,19 +106,15 @@ > */ > z = floorf(y); > if(z!=y) { /* inexact anyway */ > - y *= (float)0.5; > - y = (float)2.0*(y - floorf(y)); /* y = |x| mod 2.0 */ > - n = (int) (y*(float)4.0); > + y /= 2; > + y = 2*(y - floorf(y)); /* y = |x| mod 2.0 */ > + n = (int)(y*4); > } else { > - if(ix>=0x4b800000) { > - y = zero; n = 0; /* y must be even */ > - } else { > - if(ix<0x4b000000) z = y+two23; /* exact */ > - GET_FLOAT_WORD(n,z); > - n &= 1; > - y = n; > - n<<= 2; > - } > + z = y+two23; /* exact */ > + GET_FLOAT_WORD(n,z); > + n &= 1; > + y = n; > + n<<= 2; > } > switch (n) { > case 0: y = __kernel_sindf(pi*y); break; > _______________________________________________ > freebsd-numerics@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-numerics > To unsubscribe, send any mail to "freebsd-numerics-unsubscribe@freebsd.org > " >