w_j0.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* @(#)w_j0.c 5.1 93/09/24 */
  2. /*
  3. * ====================================================
  4. * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  5. *
  6. * Developed at SunPro, a Sun Microsystems, Inc. business.
  7. * Permission to use, copy, modify, and distribute this
  8. * software is freely granted, provided that this notice
  9. * is preserved.
  10. * ====================================================
  11. */
  12. #if defined(LIBM_SCCS) && !defined(lint)
  13. static char rcsid[] = "$NetBSD: w_j0.c,v 1.6 1995/05/10 20:49:11 jtc Exp $";
  14. #endif
  15. /*
  16. * wrapper j0(double x), y0(double x)
  17. */
  18. #include "math.h"
  19. #include "math_private.h"
  20. #ifdef __STDC__
  21. double j0(double x) /* wrapper j0 */
  22. #else
  23. double j0(x) /* wrapper j0 */
  24. double x;
  25. #endif
  26. {
  27. #ifdef _IEEE_LIBM
  28. return __ieee754_j0(x);
  29. #else
  30. double z = __ieee754_j0(x);
  31. if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
  32. if(fabs(x)>X_TLOSS) {
  33. return __kernel_standard(x,x,34); /* j0(|x|>X_TLOSS) */
  34. } else
  35. return z;
  36. #endif
  37. }
  38. #ifdef __STDC__
  39. double y0(double x) /* wrapper y0 */
  40. #else
  41. double y0(x) /* wrapper y0 */
  42. double x;
  43. #endif
  44. {
  45. #ifdef _IEEE_LIBM
  46. return __ieee754_y0(x);
  47. #else
  48. double z;
  49. z = __ieee754_y0(x);
  50. if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
  51. if(x <= 0.0){
  52. if(x==0.0)
  53. /* d= -one/(x-x); */
  54. return __kernel_standard(x,x,8);
  55. else
  56. /* d = zero/(x-x); */
  57. return __kernel_standard(x,x,9);
  58. }
  59. if(x>X_TLOSS) {
  60. return __kernel_standard(x,x,35); /* y0(x>X_TLOSS) */
  61. } else
  62. return z;
  63. #endif
  64. }