From Martin Maechler <maechler@stat.math.ethz.ch>  Mon May 22 16:03:18 2000
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Mon, 22 May 2000 17:03:18 +0200 (CEST)
Subject: [Rd] hypot(x,y) instead of pythag(a,b) ?!
In-Reply-To: <14633.17445.635566.303613@gargle.gargle.HOWL>
References: <14633.17445.635566.303613@gargle.gargle.HOWL>
Message-ID: <14633.19510.222102.346537@gargle.gargle.HOWL>

>>>>> "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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] hypot(x,y) instead of pythag(a,b) ?!
Martin Maechler