Actions
Bug #18188
closed-1 ** 0 is 1 not -1
Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-freebsd11.2]
Description
Any negative number to the power of 0 is 1, but ruby is returning -1.
i.e. it should be n == 0 ? 1 : x ** n
/usr/local/ruby3.0/bin/ruby
puts -1**0
-1
Actions
Like0
Like0Like0