conj.cpp 357 B

12345678910111213141516171819202122232425262728293031
  1. // Complex conjugate
  2. #include "stdafx.h"
  3. #include "defs.h"
  4. void
  5. eval_conj(void)
  6. {
  7. push(cadr(p1));
  8. eval();
  9. p1 = pop();
  10. push(p1);
  11. if (!find(p1, imaginaryunit)) { // example: (-1)^(1/3)
  12. polar();
  13. conjugate();
  14. clockform();
  15. } else
  16. conjugate();
  17. }
  18. void
  19. conjugate(void)
  20. {
  21. push(imaginaryunit);
  22. push(imaginaryunit);
  23. negate();
  24. subst();
  25. eval();
  26. }