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

Support for power #2495

Open
ColinHebert opened this issue Dec 9, 2024 · 0 comments
Open

Support for power #2495

ColinHebert opened this issue Dec 9, 2024 · 0 comments
Labels
feature-request New feature or request.

Comments

@ColinHebert
Copy link

ColinHebert commented Dec 9, 2024

Is your feature request related to a problem? Please describe..
I am trying to do some quick math operation on IP addresses and masks.
In particular from a mask (10.0.0.0/16), finding how many IP addresses are available.
The operation should be simple 2^(32-x) where x is the mask.

Describe the solution you'd like
Support the power operation, either natively x^y, x**y, or through a function pow(x, y)

Describe alternatives you've considered
At the moment the alternative is a bit (unnecessarily) complex:

product(
  number(
    split("1"+"2"*(32-mask), "")
  )
)

Generate a string of "2" n times, split it into an array of n entries, transform into numbers, and run product on the array.

@ColinHebert ColinHebert added the feature-request New feature or request. label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request.
Projects
None yet
Development

No branches or pull requests

1 participant