Why -2**4 is not 16 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why -2**4 is not 16

output of -2 to the power 4 is -16 .why not giving positive value.

15th Jul 2017, 2:07 PM
Somasundaram R
Somasundaram R - avatar
3 Answers
+ 19
(-2)**4 #See why? """ You did : -(2**4)"""
15th Jul 2017, 2:10 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 6
try using it (-2)**4 I think just because of operator precedence
15th Jul 2017, 2:11 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 4
The negative sign is applied after the exponent. PEMDAS treats a negative as multiplication (since you are, in essence, multiplying by negative one)
15th Jul 2017, 2:12 PM
Keto Z
Keto Z - avatar