From owner-freebsd-numerics@FreeBSD.ORG Wed Jun 3 10:23:38 2015 Return-Path: Delivered-To: freebsd-numerics@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BD1AEAE1 for ; Wed, 3 Jun 2015 10:23:38 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8114F18EB for ; Wed, 3 Jun 2015 10:23:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 38EDC3C4430; Wed, 3 Jun 2015 20:23:24 +1000 (AEST) Date: Wed, 3 Jun 2015 20:23:24 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Steve Kargl cc: "Montgomery-Smith, Stephen" , "freebsd-numerics@freebsd.org" Subject: Re: Let's get moving In-Reply-To: <20150602002619.GA45253@troutmask.apl.washington.edu> Message-ID: <20150603201258.I1997@besplex.bde.org> References: <556CEB8C.90605@missouri.edu> <20150602002619.GA45253@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=XMDNMlVE c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=98Bt42YmqomoJD9UxmwA:9 a=CjuIK1q_8ugA:10 X-BeenThere: freebsd-numerics@freebsd.org X-Mailman-Version: 2.1.20 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, 03 Jun 2015 10:23:38 -0000 On Mon, 1 Jun 2015, Steve Kargl wrote: >> From src/math_private.h > > * The C99 standard intends x+I*y to be used for this, but x+I*y is > * currently unusable in general since gcc introduces many overflow, > * underflow, sign and efficiency bugs by rewriting I*y as > * (0.0+I)*(y+0.0*I) and laboriously computing the full complex product. > * In particular, I*Inf is corrupted to NaN+I*Inf, and I*-0 is corrupted > * to -0.0+I*0.0. > > Last time I checked, clang was even worse with regards to I. C11 now has CPLX() that can be used to handle this, and is used in a way that I don't like (to replace our old method). clang has some library support to do complex operations better. There are well known overflow problems for division, and even for addition if you want to let the real and imaginary parts overflow independently like we do in catrig*.c. The library functions might handle Infs and NaNs too. I haven't checked what they actually do. If you actually use them for every operation, then every operation becomes slow. libm wouldn't notice much since it mostly reduces to real and imaginary parts internally. Bruce