Skip to content

Commit

Permalink
feat: add std.atan2
Browse files Browse the repository at this point in the history
  • Loading branch information
CertainLach committed Nov 30, 2023
1 parent 0679858 commit a8d47a8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions stdlib/std.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -1785,4 +1785,20 @@ limitations under the License.
sha3(str):: go_only_function,

trim(str):: std.stripChars(str, ' \t\n\f\r\u0085\u00A0'),

atan2(y, x)::
local pi = std.acos(-1);
if x > 0 then
std.atan(y / x)
else if x < 0 && y >= 0 then
std.atan(y / x) + pi
else if x < 0 && y < 0 then
std.atan(y / x) - pi
else if x == 0 && y > 0 then
pi / 2
else if x == 0 && y < 0 then
-pi / 2
else
0
,
}

0 comments on commit a8d47a8

Please sign in to comment.