[Rd] hypot(x,y) instead of pythag(a,b) ?!
Prof Brian D Ripley
ripley@stats.ox.ac.uk
Wed, 24 May 2000 09:57:47 +0100 (BST)
> >>>>> Martin Maechler writes:
>
> > My "theses"
>
> > o when hypot() is available, it should be used since it will be
> > efficient, precise, etc.
> > o when it's not available, our "configure" should find out, and set
> > corresponding "HAVE_HYPOT" to `false'.
Are there any such systems? After all 1.0.1 requires hypot, and we
have heard no complaints. I suspect the cause of the confusion is
(plot.c)
#ifdef Macintosh
# define hypot pythag
#endif
so assume that the Mac port did not have hypot. However, a different
version appears in the 1.0.1 sources, and it appears _after_ hypot is first
used, so I am puzzled as to how the current version got there, or why it
would work. (If a system does not have hypot, presumably its headers do not
either!)
> > o in that case, we should provide a hypot() {for the above code to
> > work!}, and we probably should use (an improvement?) of the current
> > pythag() function [src/appl/pythag.c in R versions <= 1.0.1].
> > o Hence, we should drop pythag() from the R API and rather say that we
> > provide hypot() whenever the system's C library
> > (or its "math.h", aka libm.*, aka "-m" part, respectively) does *not*
> > provide it.
I was puzzled as to why you put it in the API at all.
> > o I think an R function hypot() would also make sense.
Don't think so. What you we is an n-term not 2-term version, and that's
what vecnorm would do (if we had it).
This does all seem to me to be trying to solve a non-existent problem.
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._