Bend icon indicating copy to clipboard operation
Bend copied to clipboard

(Request) Power operation for integers

Open Arkitu opened this issue 1 year ago • 3 comments

Describe the bug The expression 2**1 evaluates to 3.

To Reproduce

def main():
  return 2**1

Expected behavior This code should return 2

Desktop (please complete the following information):

  • OS: Mac OS 14.4.1
  • CPU: M1
  • GPU: M1
  • Cuda Version: None

Arkitu avatar May 21 '24 19:05 Arkitu

The expression 2 ** 1 produces the result of 2 ^ 1 because HVM implements exponentiation only for floating point numbers at the moment. We have a table of the supported operations here.

imaqtkatt avatar May 21 '24 19:05 imaqtkatt

Is there a plan to make invalid operations like these produce compile time errors?

Epicguru avatar May 21 '24 21:05 Epicguru

Yes, once we add a type system

developedby avatar May 21 '24 22:05 developedby