From owner-freebsd-numerics@freebsd.org Sun Apr 9 22:08:15 2017 Return-Path: Delivered-To: freebsd-numerics@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 AB6E8D3680A for ; Sun, 9 Apr 2017 22:08:15 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 91C00A26 for ; Sun, 9 Apr 2017 22:08:15 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id v39M89Lt025089 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 9 Apr 2017 15:08:09 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id v39M89U5025088 for freebsd-numerics@freebsd.org; Sun, 9 Apr 2017 15:08:09 -0700 (PDT) (envelope-from sgk) Date: Sun, 9 Apr 2017 15:08:09 -0700 From: Steve Kargl To: freebsd-numerics@freebsd.org Subject: Implementation of half-cycle trignometric functions Message-ID: <20170409220809.GA25076@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: freebsd-numerics@freebsd.org X-Mailman-Version: 2.1.23 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: Sun, 09 Apr 2017 22:08:15 -0000 Both IEEE-754 2008 and ISO/IEC TS 18661-4 define the half-cycle trignometric functions cospi, sinpi, and tanpi. The attached patch implements cospi[fl], sinpi[fl], and tanpi[fl]. Limited testing on the cospi and sinpi reveal a max ULP less than 0.89; while tanpi is more problematic with a max ULP less than 2.01 in the interval [0,0.5]. The algorithms used in these functions are documented in {ks}_cospi.c, {ks}_sinpi.c, and s_tanpi.c. Note 1. ISO/IEC TS 18661-4 says these funstions are guarded by a predefine macro. I have no idea or interest in what clang and gcc do with regards to this macro. I've put the functions behind __BSD_VISIBLE. Note 2. I no longer have access to a system with ld128 and adequate support to compile and test the ld128 implementations of these functions. Given the almost complete lack of input from others on improvements to libm, I doubt that anyone cares. If someone does care, the ld128 files contain a number of FIXME comments, and in particular, while the polynomial coefficients are given I did not update the polynomial algorithms to properly use the coefficients. The code is attached the bug reportr. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218514 -- Steve 20161221 https://www.youtube.com/watch?v=IbCHE-hONow From owner-freebsd-numerics@freebsd.org Thu Apr 13 17:12:54 2017 Return-Path: Delivered-To: freebsd-numerics@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 C1149D3B46C; Thu, 13 Apr 2017 17:12:54 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8ED68808; Thu, 13 Apr 2017 17:12:54 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id v3DHCm5v086804 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 13 Apr 2017 10:12:48 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id v3DHCmGX086803; Thu, 13 Apr 2017 10:12:48 -0700 (PDT) (envelope-from sgk) Date: Thu, 13 Apr 2017 10:12:48 -0700 From: Steve Kargl To: freebsd-numerics@freebsd.org Cc: freebsd-standards@freebsd.org Subject: Re: Implementation of half-cycle trignometric functions Message-ID: <20170413171248.GA86780@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: <20170409220809.GA25076@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170409220809.GA25076@troutmask.apl.washington.edu> User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: freebsd-numerics@freebsd.org X-Mailman-Version: 2.1.23 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, 13 Apr 2017 17:12:54 -0000 On Sun, Apr 09, 2017 at 03:08:09PM -0700, Steve Kargl wrote: > Both IEEE-754 2008 and ISO/IEC TS 18661-4 define the half-cycle > trignometric functions cospi, sinpi, and tanpi. The attached > patch implements cospi[fl], sinpi[fl], and tanpi[fl]. Limited > testing on the cospi and sinpi reveal a max ULP less than 0.89; > while tanpi is more problematic with a max ULP less than 2.01 > in the interval [0,0.5]. The algorithms used in these functions > are documented in {ks}_cospi.c, {ks}_sinpi.c, and s_tanpi.c. > > Note 1. ISO/IEC TS 18661-4 says these funstions are guarded by > a predefine macro. I have no idea or interest in what clang and > gcc do with regards to this macro. I've put the functions behind > __BSD_VISIBLE. > > Note 2. I no longer have access to a system with ld128 and > adequate support to compile and test the ld128 implementations > of these functions. Given the almost complete lack of input from > others on improvements to libm, I doubt that anyone cares. If > someone does care, the ld128 files contain a number of FIXME comments, > and in particular, while the polynomial coefficients are given > I did not update the polynomial algorithms to properly use the > coefficients. > > The code is attached the bug reportr. > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218514 > While everyone is busy reviewing and testing the patch available in bugzilla, I suspect some may be wondering about the inverse half-cycle trignometric functions. I have worked out an algorithm for asinpi[fl] and have a working implemenation of asinpif(x). It will take a couple of weeks (due to limited available time) before I can submit asinpi[fl], acospi[fl], and atanpi[fl], but work is in progress. -- Steve 20161221 https://www.youtube.com/watch?v=IbCHE-hONow