dlapy3.c
Go to the documentation of this file.
00001 /* dlapy3.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 doublereal dlapy3_(doublereal *x, doublereal *y, doublereal *z__)
00017 {
00018     /* System generated locals */
00019     doublereal ret_val, d__1, d__2, d__3;
00020 
00021     /* Builtin functions */
00022     double sqrt(doublereal);
00023 
00024     /* Local variables */
00025     doublereal w, xabs, yabs, zabs;
00026 
00027 
00028 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00029 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00030 /*     November 2006 */
00031 
00032 /*     .. Scalar Arguments .. */
00033 /*     .. */
00034 
00035 /*  Purpose */
00036 /*  ======= */
00037 
00038 /*  DLAPY3 returns sqrt(x**2+y**2+z**2), taking care not to cause */
00039 /*  unnecessary overflow. */
00040 
00041 /*  Arguments */
00042 /*  ========= */
00043 
00044 /*  X       (input) DOUBLE PRECISION */
00045 /*  Y       (input) DOUBLE PRECISION */
00046 /*  Z       (input) DOUBLE PRECISION */
00047 /*          X, Y and Z specify the values x, y and z. */
00048 
00049 /*  ===================================================================== */
00050 
00051 /*     .. Parameters .. */
00052 /*     .. */
00053 /*     .. Local Scalars .. */
00054 /*     .. */
00055 /*     .. Intrinsic Functions .. */
00056 /*     .. */
00057 /*     .. Executable Statements .. */
00058 
00059     xabs = abs(*x);
00060     yabs = abs(*y);
00061     zabs = abs(*z__);
00062 /* Computing MAX */
00063     d__1 = max(xabs,yabs);
00064     w = max(d__1,zabs);
00065     if (w == 0.) {
00066 /*     W can be zero for max(0,nan,0) */
00067 /*     adding all three entries together will make sure */
00068 /*     NaN will not disappear. */
00069         ret_val = xabs + yabs + zabs;
00070     } else {
00071 /* Computing 2nd power */
00072         d__1 = xabs / w;
00073 /* Computing 2nd power */
00074         d__2 = yabs / w;
00075 /* Computing 2nd power */
00076         d__3 = zabs / w;
00077         ret_val = w * sqrt(d__1 * d__1 + d__2 * d__2 + d__3 * d__3);
00078     }
00079     return ret_val;
00080 
00081 /*     End of DLAPY3 */
00082 
00083 } /* dlapy3_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:46