This is the mail archive of the
gsl-discuss@sourceware.cygnus.com
mailing list for the GSL project.
HAVE_HYPOT
- To: GNU Scientific Library list <gsl-discuss@sourceware.cygnus.com>
- Subject: HAVE_HYPOT
- From: Brian Gough <bjg@netsci.freeserve.co.uk>
- Date: Mon, 15 Feb 1999 16:44:46 +0000
As hypot(x,y) is not part of ANSI C we might want to provide a
replacement gsl_hypot that could also be used internally. Something like
a=fabs(x); b=fabs(y) ;
if (a > b) { u = b / a ; return a * sqrt(1 + u * u) ; }
else if (b > a) { v = a / b ; return b * sqrt(1 + v * v) ; }
else { return a * sqrt(2.0) ; }
takes care of large arguments. There is probably a nice implementation
in one of the existing libraries.