44 ms·
In Excel (and some other languages), unary minus has higher precedence than exponentiation, so that -x^2 = (-x)^2 = x^2. That can bite you (for example when cal
by FabHK 2y ago
In Excel (and some other languages), unary minus has higher precedence than exponentiation, so that -x^2 = (-x)^2 = x^2. That can bite you (for example when calculating the normal probability density function “manually”).
- secondcoming 2y agoAre there languages where this isn’t the case?
- cjbillington 2y agoPython for one, and given that, I'd assume most languages.
- smabie 2y agoalmost all of them?
- grumpyprole 2y agoStandard mathematical notation?
- seanhunter 2y agoIn the UK at least if you don’t put the parentheses you will get flagged for a ‘bidmas error’ because indexes (exponentiation) have higher precedence than multiplication Source: have made this mistake. Have been flagged.
- fennecbutt 2y agoI learnt this in NZ as bedmas. Brackets, exponents, division, multiplication, addition, subtraction. Bedmas, Christmas in bed!