(01-04-2021 04:16 AM)WrongWay Wrote: [ -> ]-2^2 on the 41CV evaluates to 4
You’re probably doing
2 CHS x^2
That’s (-2)^2
If you want -2^2 then the right keystrokes sequence should be
2 x^2 CHS
Or the respondent is being a bit of a smart ass
. Agreed though, there is no room for ambiguity. you need to be clear if you want -(2)^2 or (-2)^2. Happy new year to all.
(01-04-2021 04:26 AM)rprosperi Wrote: [ -> ]If the equation is ambiguous and precedence rules are not provided, a 'correct' answer is not possible, and it probably means someone is trying to lure you in to a conversation like this one.
Code:
TryAPL Version 3.4.1 (Dyalog version 18.0)
Mon Jan 04 2021 07:31:33
Copyright (c) Dyalog Limited 1982-2021
-2*2
¯4
¯2*2
4
What other languages disambiguate such expressions by providing a separate symbol for a negative value?