zuchk.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* zuchk.f -- translated by f2c (version 20100827).
  2. This file no longer depends on f2c.
  3. */
  4. #include "slatec-internal.hpp"
  5. int zuchk_(double *yr, double *yi, integer *nz,
  6. double *ascle, double *tol)
  7. {
  8. double wi, ss, st, wr;
  9. /* ***BEGIN PROLOGUE ZUCHK */
  10. /* ***SUBSIDIARY */
  11. /* ***PURPOSE Subsidiary to SERI, ZUOIK, ZUNK1, ZUNK2, ZUNI1, ZUNI2 and */
  12. /* ZKSCL */
  13. /* ***LIBRARY SLATEC */
  14. /* ***TYPE ALL (CUCHK-A, ZUCHK-A) */
  15. /* ***AUTHOR Amos, D. E., (SNL) */
  16. /* ***DESCRIPTION */
  17. /* Y ENTERS AS A SCALED QUANTITY WHOSE MAGNITUDE IS GREATER THAN */
  18. /* EXP(-ALIM)=ASCLE=1.0E+3*D1MACH(1)/TOL. THE TEST IS MADE TO SEE */
  19. /* IF THE MAGNITUDE OF THE REAL OR IMAGINARY PART WOULD UNDERFLOW */
  20. /* WHEN Y IS SCALED (BY TOL) TO ITS PROPER VALUE. Y IS ACCEPTED */
  21. /* IF THE UNDERFLOW IS AT LEAST ONE PRECISION BELOW THE MAGNITUDE */
  22. /* OF THE LARGEST COMPONENT; OTHERWISE THE PHASE ANGLE DOES NOT HAVE */
  23. /* ABSOLUTE ACCURACY AND AN UNDERFLOW IS ASSUMED. */
  24. /* ***SEE ALSO SERI, ZKSCL, ZUNI1, ZUNI2, ZUNK1, ZUNK2, ZUOIK */
  25. /* ***ROUTINES CALLED (NONE) */
  26. /* ***REVISION HISTORY (YYMMDD) */
  27. /* ?????? DATE WRITTEN */
  28. /* 910415 Prologue converted to Version 4.0 format. (BAB) */
  29. /* ***END PROLOGUE ZUCHK */
  30. /* COMPLEX Y */
  31. /* ***FIRST EXECUTABLE STATEMENT ZUCHK */
  32. *nz = 0;
  33. wr = abs(*yr);
  34. wi = abs(*yi);
  35. st = min(wr,wi);
  36. if (st > *ascle) {
  37. return 0;
  38. }
  39. ss = max(wr,wi);
  40. st /= *tol;
  41. if (ss < st) {
  42. *nz = 1;
  43. }
  44. return 0;
  45. } /* zuchk_ */