🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2884

Re: gcc 1.37, sun3 version, and X11R4

#2884
From: Jim Meyering
Date: Thu, 22 Feb 1990 04:37
44 lines
1527 bytes
In article <9002220012.AA05757@csvax.caltech.edu>
andy@CSVAX.CALTECH.EDU (Andy Fyfe) suggests the following patch
>
>*** math-68881.h	Wed Feb 14 01:07:28 1990
>--- /usr/local/lib/gcc-include/math-68881.h	Wed Feb 21 12:01:32 1990
>***************
>*** 250,253 ****
>--- 250,258 ----
>  }
>  
>+ __inline static const double hypot (const double x, const double y)
>+ {
>+     return sqrt(x*x + y*y);
>+ }
>+ 
>  __inline static const double pow (const double x, const double y)
>  {

That may be fine if you're VERY concerned about speed, but it
should be worth a small sacrifice to assure more accurate results;
the version of hypot() above can experience unwarranted loss of
precision, overflow, or destructive underflow.

__inline static const double
hypot(const double x, const double y)
{
    register double u;
    double sqrt();
#define ABS(x) ((x) < 0.0 ? -(x) : (x))

    if (ABS(x) >= ABS(y)) {
	if (x == 0.0)
	    return (0.0);
	u = y / x;
	return (x * sqrt(1.0 + u * u));
    }
    else {
	u = x / y;
	return (y * sqrt(1.0 + u * u));
    }
#undef ABS
}
-- 
Jim Meyering      meyering@cs.utexas.edu
Technical Details
Message-ID: <678@ai.cs.utexas.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!meyering
References: <9002220012.AA05757@csvax.caltech.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!meyering
From: meyering@cs.utexas.edu (Jim Meyering)
Newsgroups: gnu.gcc.bug
Subject: Re: gcc 1.37, sun3 version, and X11R4
Message-ID: <678@ai.cs.utexas.edu>
Date: 22 Feb 90 04:37:35 GMT
References: <9002220012.AA05757@csvax.caltech.edu>
Distribution: gnu
Organization: U of TX at Austin CS Dept
Lines: 44