fix: correct std.atan2 parameter names to match spec#905
Merged
Conversation
Motivation:
The Jsonnet spec defines std.atan2(y, x) but the parameter names were
declared as "x", "y" causing named argument calls like std.atan2(y=1, x=0)
to produce incorrect results.
Modification:
Swap parameter names from ("x", "y") to ("y", "x") in the builtin
declaration to match the spec.
Result:
Named argument calls now work correctly: std.atan2(y=1, x=0) returns π/2.
He-Pin
commented
Jun 9, 2026
| builtin("atan2", "x", "y") { (pos, ev, x: Double, y: Double) => | ||
| math.atan2(x, y) | ||
| builtin("atan2", "y", "x") { (pos, ev, y: Double, x: Double) => | ||
| math.atan2(y, x) |
Contributor
Author
There was a problem hiding this comment.
std.atan2(y, x) (available since 0.21.0)
Just checked
stephenamar-db
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
std.atan2parameter names from("x", "y")to("y", "x")matching the Jsonnet specstd.atan2(y, x)std.atan2(y=1, x=0)now produce correct resultsstd.atan2(y, x) (available since 0.21.0)
Verification against go-jsonnet
sjsonnet now produces identical results.
Test plan
StdMathTests.atan2 named parameterstest