Power with unary - after / or *

Issue #450 closed
Former user created an issue

Originally reported on Google Code with ID 450

Steps to reproduce:
1/-1^2
1*-1^2

Expected behavior:
-1
-1

Experienced behavior:
1
1

Reported by helder.pereira.correia on 2013-10-12 06:24:21

Comments (6)

  1. Former user Account Deleted
    Experienced behavior is mathematically correct. Expectation expressed would be incorrect.
    Exponentiation takes precedence over division and multiplication. Unary negation takes
    precedence over exponentiation.
    
    When x=-1 x^2 should be (-1)^2 not -(1^2) since we are squaring negative 1
    so -1^2=1
    
    Subtraction of x should not take precedence over exponentiation
    1/1-1^2 should be 1/1-(1^2) since we are subtracting 1 squared
    
    When you need to negate the square simply use parentheses.
    
    Hope this helps.
    
    SpeedCrunch is great!
    

    Reported by buddygm on 2013-11-15 20:14:09

  2. Former user Account Deleted
    I wish it was that simple. Please see issue 160
    

    Reported by helder.pereira.correia on 2013-11-16 09:21:55

  3. Log in to comment