You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I agree this is useful, and yes, your code is correct for that.
I have such helper in one of my projects using jsonnet for now:
local atan2(y, x) =
if x > 0then
atan(y / x)
elseif x < 0 && y >= 0then
atan(y / x) + pi
elseif x < 0 && y < 0then
atan(y / x) - pi
elseif x == 0 && y > 0then
pi / 2elseif x == 0 && y < 0then
-pi / 2elseerror"atan2(0, 0) is undefined";
But I agree this is acceptable to add this to standard library. The problem is, it should also be added to official jsonnet implementation...
I also have nearly the same jsonnet atan2 code myself too, but it just seems better to be in std with all the other trig. I put a request in for the c++ library as well: google/jsonnet#1118
But, since jrsonnet is way faster and what I actually use, this is where I'd really like it :).
It would be great to add atan2 to std. atan2 is super useful for converting from rectangular to polar coordinates.
I think it looks something like this, but ... I'm not expert with rust at all:
The text was updated successfully, but these errors were encountered: