From owner-freebsd-numerics@freebsd.org Wed Jul 25 07:35:06 2018 Return-Path: Delivered-To: freebsd-numerics@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25CA81041CCF for ; Wed, 25 Jul 2018 07:35:06 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 95278736BD for ; Wed, 25 Jul 2018 07:35:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 54661428975; Wed, 25 Jul 2018 17:34:54 +1000 (AEST) Date: Wed, 25 Jul 2018 17:34:53 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: enh cc: freebsd-numerics@freebsd.org Subject: Re: fmod nan_mix usage In-Reply-To: Message-ID: <20180725170218.M835@besplex.bde.org> References: <20180724050141.Q2280@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=EseilWUA c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=Oh2cFVv5AAAA:8 a=Wpfb0w___zvaJdmtPHIA:9 a=CjuIK1q_8ugA:10 a=7KeoIwV6GZqOttXkcoxL:22 X-BeenThere: freebsd-numerics@freebsd.org X-Mailman-Version: 2.1.27 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: Wed, 25 Jul 2018 07:35:06 -0000 On Mon, 23 Jul 2018, enh wrote: > On Mon, Jul 23, 2018 at 12:54 PM Bruce Evans wrote: > ... > bionic doesn't have as many as it should, though i do add them any time we > catch a regression. all our tests are in > https://android.googlesource.com/platform/bionic/+/master/tests/ with > complex_test.cpp and math_test.cpp being the interesting ones. > (complex_test.cpp is laughably perfunctory right now, but sadly *did* catch > bugs where historically the makefiles were broken and we weren't shipping > all the functions for all the architectures.) Are most of your systems arm? I think libm doesn't get much testing on arm in FreeBSD (I have never even run cc on an arm system), so it especially useful to have tests for it on other systems. This also partly explains why my recent tests didn't see the bug -- x86 has fmod, remainder and remquo in asm or builtins so the C versions are not normally used. Maybe arm should have a bit more in asm or builtins. > ... >>> it looks like e_remainder.c might have the same issue, but Android's >> tests >>> didn't catch that :-( i'll improve the tests... >> >> Indeed. Also remquo* and ctanh* :-(. ctanh* should be more like csinh* >> and ccosh*, and it was. > > yeah, i caught remquo after i hit send (and have just uploading a CL with > the missing tests). i'm glad to hear that ctanh* actually works because i'd > failed to break it :-) i'll commit those extra tests too anyway. ctanh* turned out to not need multiplicative NaN mixing. It is both more complicated and simpler than ccosh* and csinh*, since it has more complicated expressions so needs more special cases for exceptional args, but then the individual cases are simpler. >... >> The only other complicated case seems to be hypot[fl](). This subtracts >> instead of adds, since it wants to convert Inf-Inf to NaN. > > hypot seems okay from my testing. am i missing another test? It passes my tests too, but uses a complicated method to pass. I first noticed difference related to precisions with it, and fixed them less systematically than with nan_mix*. I think it only uses subtractive mixing because that worked to preserve the arg order in SSE because SSE doesn't have reverse subtraction. That is too special. Bruce