Why does -1^-2147483648 = 1?


  • 0
    T

    My code fails the following test:

    Input: -1.00000, -2147483648
    Output: -1.00000
    Expected: 1.00000

    Why is this the wrong output?

    Edit:
    Thanks for answering (-1)^2=1, I realized that after I posted the question...


  • 3
    S

    obviously it should be 1.

    (-1)^2=(-1)^(-2)=1


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.