Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More math functions/constants #1186

Closed
rben01 opened this issue Dec 3, 2024 · 1 comment
Closed

More math functions/constants #1186

rben01 opened this issue Dec 3, 2024 · 1 comment

Comments

@rben01
Copy link
Contributor

rben01 commented Dec 3, 2024

I believe the following don't yet exist in jsonnet. If not, it would be great if they were added:

  • pi = 3.141592653589793
  • deg2rad(x) = pi/180 * x
  • rad2deg(x) = 180/pi * x
  • atan2(y, x)
  • pow2, pow10 (it's nice to have unary functions instead of needing to define the lambda)
  • log2, log10 (easier and shorter than remembering that log_a(b) = log(b)/log(a))
  • round(x, places=0) to customize how many decimals to keep
  • hypot(x, y) = sqrt(x*x + y*y)
@johnbartholomew
Copy link
Collaborator

Corresponding PR #1187 has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants