Guest User

Untitled

a guest
Jan 17th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. e^(ix) = cos(x) + i sin(x)
  2.  
  3. struct complex
  4. {
  5. float real;
  6. float imag;
  7. };
  8.  
  9. struct complex sum(struct complex t1, struct complex t2)
  10. {
  11. struct complex t;
  12. t.real = t1.real + t2.real;
  13. t.imag = t1.imag + t2.imag;
  14. return t;
  15. }
  16.  
  17. struct complex product(struct complex t1, struct complex t2)
  18. {
  19. struct complex t;
  20. t.real = t1.real * t2.real - t1.imag * t2.imag;
  21. t.imag = t1.real * t2.imag + t1.imag * t2.real;
  22. return t;
  23. }
Add Comment
Please, Sign In to add comment