dlapy2.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* dlapy2.f -- translated by f2c (version 20061008).
  2. You must link the resulting object file with libf2c:
  3. on Microsoft Windows system, link with libf2c.lib;
  4. on Linux or Unix systems, link with .../path/to/libf2c.a -lm
  5. or, if you install libf2c.a in a standard place, with -lf2c -lm
  6. -- in that order, at the end of the command line, as in
  7. cc *.o -lf2c -lm
  8. Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
  9. http://www.netlib.org/f2c/libf2c.zip
  10. */
  11. #include "f2c.h"
  12. #include "blaswrap.h"
  13. doublereal _starpu_dlapy2_(doublereal *x, doublereal *y)
  14. {
  15. /* System generated locals */
  16. doublereal ret_val, d__1;
  17. /* Builtin functions */
  18. double sqrt(doublereal);
  19. /* Local variables */
  20. doublereal w, z__, xabs, yabs;
  21. /* -- LAPACK auxiliary routine (version 3.2) -- */
  22. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  23. /* November 2006 */
  24. /* .. Scalar Arguments .. */
  25. /* .. */
  26. /* Purpose */
  27. /* ======= */
  28. /* DLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary */
  29. /* overflow. */
  30. /* Arguments */
  31. /* ========= */
  32. /* X (input) DOUBLE PRECISION */
  33. /* Y (input) DOUBLE PRECISION */
  34. /* X and Y specify the values x and y. */
  35. /* ===================================================================== */
  36. /* .. Parameters .. */
  37. /* .. */
  38. /* .. Local Scalars .. */
  39. /* .. */
  40. /* .. Intrinsic Functions .. */
  41. /* .. */
  42. /* .. Executable Statements .. */
  43. xabs = abs(*x);
  44. yabs = abs(*y);
  45. w = max(xabs,yabs);
  46. z__ = min(xabs,yabs);
  47. if (z__ == 0.) {
  48. ret_val = w;
  49. } else {
  50. /* Computing 2nd power */
  51. d__1 = z__ / w;
  52. ret_val = w * sqrt(d__1 * d__1 + 1.);
  53. }
  54. return ret_val;
  55. /* End of DLAPY2 */
  56. } /* _starpu_dlapy2_ */