c_log.c 384 B

1234567891011121314151617181920212223
  1. #include "f2c.h"
  2. #ifdef KR_headers
  3. extern double log(), f__cabs(), atan2();
  4. VOID c_log(r, z) complex *r, *z;
  5. #else
  6. #undef abs
  7. #include "math.h"
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. extern double f__cabs(double, double);
  12. void c_log(complex *r, complex *z)
  13. #endif
  14. {
  15. double zi, zr;
  16. r->i = atan2(zi = z->i, zr = z->r);
  17. r->r = log( f__cabs(zr, zi) );
  18. }
  19. #ifdef __cplusplus
  20. }
  21. #endif