Jump to content

Alfred calculator: negative exponent bug


Recommended Posts

When executing negative exponents in parenthesis numbers are often inconsistent. I guess it could be the notation's way of interpreting order of operations but I'd expect all of these to work the same way. At the very least, I'd expect the first screenshot here to be correct, ie. -2 to the power of 4 should equal 16.

1419641984_ScreenShot2021-03-22at2_22_42PM.thumb.png.82399d68c3eecf92f76a2aec1e83cd79.png

1152033237_ScreenShot2021-03-22at2_23_27PM.thumb.png.3aebcba3676415cfc8293ff8051ed6c9.png

694152966_ScreenShot2021-03-22at2_32_16PM.thumb.png.60d7e77094a20b63818961af813e3056.png

 

Not sure if this helps, but it could be that the interpreter is evaluating the negative sign as a subtraction operator and putting precedence on the exponent operation first. ie. it's trying to respect PEMDAS but the negative symbol should not be treated an operator, per se. It should applied to any int/float directly following it before executing operations in normal PEMDAS order.

 

In case anyone's not familiar with the acronym:

Parenthesis

Exponents

Multiplication

Division

Addition

Subtraction

 

 

 

Edited by sudopeople
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...