From owner-cvs-all@FreeBSD.ORG Sun Oct 9 21:07:24 2005 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 20A5A16A41F; Sun, 9 Oct 2005 21:07:24 +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 E6D0543D48; Sun, 9 Oct 2005 21:07:23 +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 j99L7Nki037425; Sun, 9 Oct 2005 21:07:23 GMT (envelope-from bde@repoman.freebsd.org) Received: (from bde@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j99L7Nor037424; Sun, 9 Oct 2005 21:07:23 GMT (envelope-from bde) Message-Id: <200510092107.j99L7Nor037424@repoman.freebsd.org> From: Bruce Evans Date: Sun, 9 Oct 2005 21:07:23 +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 k_cosf.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Oct 2005 21:07:24 -0000 bde 2005-10-09 21:07:23 UTC FreeBSD src repository Modified files: lib/msun/src k_cosf.c Log: Fix numerous errors of >= 1 ulp for cosf(x) and sinf(x) (1 line) and add a comment about related magic (many lines)). __kernel_cos[f]() needs a trick to reduce the error to below 1 ulp when |x| >= 0.3 for the range-reduced x. Modulo other bugs, naive code that doesn't use the trick would have an error of >= 1 ulp in about 0.00006% of cases when |x| >= 0.3 for the unreduced x, with a maximum relative error of about 1.03 ulps. Mistransation of the trick from the double precision case resulted in errors in about 0.2% of cases, with a maximum relative error of about 1.3 ulps. The mistranslation involved not doing implicit masking of the 32-bit float word corresponding to to implicit masking of the lower 32-bit double word by clearing it. sinf() uses __kernel_cosf() for half of all cases so its errors from this bug are similar. tanf() is not affected. The error bounds in the above and in my other recent commit messages are for amd64. Extra precision for floats on i386's accidentally masks this bug, but only if k_cosf.c is compiled with -O. Although the extra precision helps here, this is accidental and depends on longstanding gcc precision bugs (not clipping extra precision on assignment...), and the gcc bugs are mostly avoided by compiling without -O. I now develop libm mainly on amd64 systems to simplify error detection and debugging. Revision Changes Path 1.8 +12 -1 src/lib/msun/src/k_cosf.c