andy@CSVAX.CALTECH.EDU (Andy Fyfe) (02/22/90)
It was previously reported that when the X server was compiled on a sun3
with gcc 1.37 it failed to correctly draw wide lines. The posting pointed
out that if the file server/ddx/mi/miwideline.c was compiled with cc the
problem went away. As it turns out, the problem is that the function
hypot() is not declared in the function math-68881.h which we include
here when __HAVE_68881__ is defined. Gcc assumes hypot() returns an int
and bad things happen. The following patch adds hypot() to math-68881.h.
Two files need to be recompiled, miwideline.c and miarc.c, as both call
hypot().
*** 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)
{
meyering@cs.utexas.edu (Jim Meyering) (02/22/90)
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