[Rd] hypot(x,y) instead of pythag(a,b) ?!
Martin Maechler
Martin Maechler <maechler@stat.math.ethz.ch>
Mon, 22 May 2000 17:03:18 +0200 (CEST)
>>>>> "MM" == Martin Maechler <maechler@stat.math.ethz.ch> writes:
MM> Some of you may have seen the pythag() part in the R API definition
MM> in "Writing R Extensions" (source = doc/manual/R-exts.texinfo).
MM> or followed the report and Prof. Brian Ripley's answer about
MM> pythag()'s availability from R's binary.
MM> As we say in above manual
>>> `pythag(A, B)' computes `sqrt(A^2 + B^2)' without overflow or
>>> destructive underflow: for example it still works when both A and B
>>> are between `1e200' and `1e300' (in IEEE double precision).
MM> -- "Problem" is : The GNU C library (and other C libraries ??)
MM> defines a function double hypot(double x, double y)
MM> with identical semantics to our pythag() from above The Info
MM> (e.g. in Linux Emacs C-h i "m libc") about "Libc" contains (in the
MM> section "Exponentiation and Logarithms"):
....
I forgot to mention that src/appl/eigen.f (stemming from EISPACK)
defines (and uses) a fortran DOUBLE PRECISION PYTHAG(A, B) function
equivalently to src/appl/pythag.c {currently (R-devel) in .../approx.c},
and hence R's eigen() function actually does rely on pythag().
Martin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._