Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Dec 2007 04:08:33 -0500
From:      David Schultz <das@FreeBSD.ORG>
To:        Steve Kargl <sgk@troutmask.apl.washington.edu>
Cc:        freebsd-standards@FreeBSD.ORG
Subject:   Re: [PATCH] hypotl, cabsl, and code removal in cabs
Message-ID:  <20071206090833.GA95428@VARK.MIT.EDU>
In-Reply-To: <20071012180959.GA36345@troutmask.apl.washington.edu>
References:  <20071012180959.GA36345@troutmask.apl.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
I like the approach. One concern, though, is that IEEE 754
requires sqrt to always be correctly rounded, and one might
reasonably expect the same from hypot. If we believe that, then
the intermediate quantity a*a + b*b needs to be computed exactly;
if it is rounded before we take the square root, the double
rounding may cause us to round the wrong way. This basically
requires computing things with twice as many bits of precision.
Arguably, though, your code is correct in the most important
ways (avoiding underflow/overflow).

Also, umm, I've been busy and unable to pay attention for a while,
so forgive me if I'm missing something, but isn't it the case that
we don't have a sqrtl(), except for the gcc builtin on some
architectures?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071206090833.GA95428>