Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

binary op not implemented: Pow #36

Closed
MirkoDziadzka opened this issue Jan 5, 2017 · 4 comments · Fixed by #79
Closed

binary op not implemented: Pow #36

MirkoDziadzka opened this issue Jan 5, 2017 · 4 comments · Fixed by #79

Comments

@MirkoDziadzka
Copy link
Contributor

how to reproduce

try to compile

MAX_TCP_PORT = (2 ** 16) - 1

expected result

it compiles

actual result

line 3: binary op not implemented: Pow
@MirkoDziadzka
Copy link
Contributor Author

https://github.com/MirkoDziadzka/grumpy/commit/9ad4a5ad148ca7b356750b15a114ba710d6739f8 solved my immediate problem. But the implementation is neither complete, nor necessary correct or tested

@dpavlin
Copy link

dpavlin commented Jan 5, 2017

Thanks, I had same problem and your patched helped. Let's hope we will see it in upstream version soon.

@MirkoDziadzka
Copy link
Contributor Author

Please note that this

  • works only for integers, not long integers or floating point numbers
  • works only if the result can be converted into a signed 64bit number (if the result is too big, you will get negative numbers, try 2 ** 64)
  • may loose precision for large numbers

So it is by no means a fix for the problem, only a hot-fix for some cases which solved my needs.

@trotterdylan
Copy link
Contributor

@MirkoDziadzka Thanks for the PR. I commented on it. I'm fine with an incomplete implementation but I just want to make sure we fail hard when we encounter an overflow situation rather than silently giving bad results.

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

Successfully merging a pull request may close this issue.

3 participants