From owner-freebsd-bugs@freebsd.org Wed Aug 31 03:57:37 2016 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8502ABC7848 for ; Wed, 31 Aug 2016 03:57:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 4E6C8D8E for ; Wed, 31 Aug 2016 03:57:36 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id B15BB1043522 for ; Wed, 31 Aug 2016 13:57:34 +1000 (AEST) Date: Wed, 31 Aug 2016 13:57:31 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org cc: freebsd-bugs@freebsd.org Subject: Re: [Bug 211965] [patch] fmodl not properly aliased on architectures where LDBL_PREC == 53 (arm, mips, powerpc) In-Reply-To: Message-ID: <20160831134341.H1044@besplex.bde.org> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=VIkg5I7X c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=-DFVLdXdAAAA:8 a=Foz7gF2wKGREb6kp7gcA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=GNDTZ2OQZLncw_hUeM17:22 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2016 03:57:37 -0000 On Tue, 30 Aug 2016 a bug that doesn't want replies@freebsd.org wrote: > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211965 > > Kyle Evans changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Attachment #173822|0 |1 > is obsolete| | > > --- Comment #1 from Kyle Evans --- > Created attachment 174233 > --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=174233&action=edit > svn(1) diff of lib/msun/src, standardizing conditionals and properly aliasing > fmodl I sent a patch with approved style in response to PR 199422. > As mentioned by Warner Losh [1], LDBL_MANT_DIG == 53 could be written as > LDBL_MANT_DIG == DBL_MANT_DIG to better convey the intention of this block. This is a worse way. It should be backed out if committed. The double precision version of fmod() has about 50 magic numbers related to 53. The one in this conditional must be written as 53 to match. Try writing the others as much more complicated expressions depending on DBL_MANT_DIG and other parameters to see how much easier it is to use magic numbers. Don't forget to change all the int32_t types to int<(DBL_MANT_DIG + LOG(MUMBLE(RANGE))) / 2>_t and all the packing expressions to pack the parametrised types. > I've amended this to do that, as well as to give the same treatment to the > other instances where the same meaning is intended. Also, I've standardized all > of these to a form without parentheses enclosing the statement. The other instances mostly have correct style. Bruce