From owner-freebsd-hackers@freebsd.org Fri Apr 28 01:01:23 2017 Return-Path: Delivered-To: freebsd-hackers@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 AF430D4DF87; Fri, 28 Apr 2017 01:01:23 +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 9A01B274; Fri, 28 Apr 2017 01:01:23 +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 v3S11M2W012863 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 27 Apr 2017 18:01:22 -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 v3S11MRW012862; Thu, 27 Apr 2017 18:01:22 -0700 (PDT) (envelope-from sgk) Date: Thu, 27 Apr 2017 18:01:22 -0700 From: Steve Kargl To: freebsd-numerics@freebsd.org Cc: freebsd-hackers@freebsd.org Subject: Re: Implementation of half-cycle trignometric functions Message-ID: <20170428010122.GA12814@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: <20170409220809.GA25076@troutmask.apl.washington.edu> <20170427231411.GA11346@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170427231411.GA11346@troutmask.apl.washington.edu> User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 01:01:23 -0000 On Thu, Apr 27, 2017 at 04:14:11PM -0700, Steve Kargl wrote: > > I have attached a new diff to the bugzilla report. The > diff is 3090 lines and won't be broadcast the mailing list. > > This diff includes fixes for a few inconsequential bugs > and implements modified Estrin's method for sum a few > ploynomials. If you want the previous Horner's method > then add -DHORNER to your CFLAGS. > For those curious about testing, here are some numbers for the Estrin's method. These were obtained on an AMD FX(tm)-8350 @ 4018.34-MHz. The times are in microseconds and the number in parentheses are estimated cycles. | cospi | sinpi | tanpi ------------+--------------+--------------+-------------- float | 0.0089 (37) | 0.0130 (54) | 0.0194 (80) double | 0.0134 (55) | 0.0160 (66) | 0.0249 (102) long double | 0.0557 (228) | 0.0698 (287) | 0.0956 (393) ------------+--------------+--------------+-------------- The timing tests are done on the interval [0,0.25] as this is the interval where the polynomial approximations apply. Limited accuracy testing gives | cospif | cospi | cospil -----------------+------------+------------+------------- MAX ULP | 0.88242114 | 0.89339466 | 0.88799449 Total tested | 16777214 | 16777214 | 16777214 0.8 < ULP <= 0.9 | 1613 | 1682 | 1601 0.7 < ULP <= 0.8 | 33925 | 33817 | 33843 0.6 < ULP <= 0.7 | 171799 | 172775 | 171899 -----------------+------------+------------+------------- | sinpif | sinpi | sinpil -----------------+------------+------------+------------- MAX ULP | 0.80103672 | 0.79851085 | 0.77049407 Total tested | 16777214 | 16777214 | 16777214 0.8 < ULP <= 0.9 | 1 | 0 | 0 0.7 < ULP <= 0.8 | 727 | 1075 | 546 0.6 < ULP <= 0.7 | 19268 | 22722 | 19019 -----------------+------------+------------+------------- x in [0,0.25] | tanpif | tanpi | tanpil -----------------+------------+------------+------------- MAX ULP | 1.37954760 | 1.37300168 | 1.38800823 Total tested | 16777214 | 16777214 | 16777214 1.0 < ULP | 39109 | 38712 | 38798 0.9 < ULP <= 1.0 | 130373 | 131086 | 130803 0.8 < ULP <= 0.9 | 342624 | 341350 | 341155 0.7 < ULP <= 0.8 | 687244 | 687122 | 686814 0.6 < ULP <= 0.7 | 1078964 | 1079881 | 1078555 -----------------+------------+------------+------------- In the interval [0.25,0.5] tanpi[fl] is computed by cospi / sinpi. The numbers look like x in [0.25,0.5] | tanpif | tanpi | tanpil -----------------+------------+------------+------------- MAX ULP | 1.93529165 | 2.04485533 | 1.95823689 Total tested | 16777215 | 16777215 | 16777215 1.0 < ULP | 699310 | 701244 | 698946 0.9 < ULP <= 1.0 | 442978 | 443344 | 443599 0.8 < ULP <= 0.9 | 642991 | 642561 | 642601 0.7 < ULP <= 0.8 | 889357 | 890307 | 889233 0.6 < ULP <= 0.7 | 1176473 | 1177407 | 1177121 -----------------+------------+------------+------------- -- Steve 20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4 20161221 https://www.youtube.com/watch?v=IbCHE-hONow