isaacg1 / pyth

Pyth, an extremely concise language. Try it here:
https://pyth.herokuapp.com/
MIT License
263 stars 57 forks source link

Add atan2 as .t(pair, 14) #162

Closed PurkkaKoodari closed 8 years ago

PurkkaKoodari commented 8 years ago

The result of forcing the use of a pair here is awfully long, but currently it would be even longer to do.

Example:

.t,_3 4 14

Compiles to

imp_print(trig([neg(3),(4)],(14)))

Which prints

-0.6435011087932844

All tests run correctly, and I added one to test this feature.

isaacg1 commented 8 years ago

Pyth already has this. atan2 is the same as the complex phase, implemented as P. The snippet posted is equivalent to P.j4_3, and gives the same result. I doubt this will often be shorter.