From owner-cvs-src@FreeBSD.ORG Mon Nov 28 04:58:57 2005 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D1A7C16A41F; Mon, 28 Nov 2005 04:58:57 +0000 (GMT) (envelope-from bde@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 80B1343D46; Mon, 28 Nov 2005 04:58:57 +0000 (GMT) (envelope-from bde@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id jAS4wvdM049497; Mon, 28 Nov 2005 04:58:57 GMT (envelope-from bde@repoman.freebsd.org) Received: (from bde@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id jAS4wvTq049496; Mon, 28 Nov 2005 04:58:57 GMT (envelope-from bde) Message-Id: <200511280458.jAS4wvTq049496@repoman.freebsd.org> From: Bruce Evans Date: Mon, 28 Nov 2005 04:58:57 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/lib/msun/src e_lgammaf_r.c k_cosf.c k_sinf.c math_private.h s_cosf.c s_sinf.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Nov 2005 04:58:58 -0000 bde 2005-11-28 04:58:57 UTC FreeBSD src repository Modified files: lib/msun/src e_lgammaf_r.c k_cosf.c k_sinf.c math_private.h s_cosf.c s_sinf.c Log: Use only double precision for "kernel" cosf and sinf (except for returning float). The functions are renamed from __kernel_{cos,sin}f() to __kernel_{cos,sin}df() so that misuses of them will cause link errors and not crashes. This version is an almost-routine translation with no special optimizations for accuracy or efficiency. The not-quite-routine part is that in __kernel_cosf(), regenerating the minimax polynomial with double precision coefficients gives a coefficient for the x**2 term that is not quite -0.5, so the literal 0.5 in the code and the related `hz' variable need to be modified; also, the special code for reducing the error in 1.0-x**2*0.5 is no longer needed, so it is convenient to adjust all the logic for the x**2 term a little. Note that without extra precision, it would be very bad to use a coefficient of other than -0.5 for the x**2 term -- the old version depends on multiplication by -0.5 being infinitely precise so as not to need even more special code for reducing the error in 1-x**2*0.5. This gives an unimportant increase in accuracy, from ~0.8 to ~0.501 ulps. Almost all of the error is from the final rounding step, since the choice of the minimax polynomials so that their contribution to the error is a bit less than 0.5 ulps just happens to give contributions that are significantly less (~.001 ulps). An Athlons, for uniformly distributed args in [-2pi, 2pi], this gives overall speed increases in the 10-20% range, despite giving a speed decrease of typically 19% (from 31 cycles up to 37) for sinf() on args in [-pi/4, pi/4]. Revision Changes Path 1.8 +6 -6 src/lib/msun/src/e_lgammaf_r.c 1.14 +11 -12 src/lib/msun/src/k_cosf.c 1.12 +11 -13 src/lib/msun/src/k_sinf.c 1.20 +2 -2 src/lib/msun/src/math_private.h 1.12 +7 -19 src/lib/msun/src/s_cosf.c 1.12 +7 -19 src/lib/msun/src/s_sinf.c