HP Forums

Full Version: Problems with signs law and other arithmetic operators
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
HPPRIME
+2/+2 => 1 ok
+2*+2 => 4 ok
+2*-2 => -4 ok
-2*-2 => 4 ok
5-+6 => -1 ok
5+-6 => -1 ok
5++6 // error => 11
5--6 // error => 11

In MATLAB ok
>>
+2/+2
+2*+2
-2*-2
5-+6
5+-6
5++6
5--6

ans1 = 1
ans2 = 4
ans3 = -4
ans4 = -1
ans5 = -1
ans6 = 11
ans7 = 11
Don't know why you wanted to try these expressions - HP 50G returns same results as you quote for MATLAB.
And so does the Prime in textbook and Algebraic modes.
(04-07-2015 04:36 PM)compsystems Wrote: [ -> ]5++6 // error
5--6 // error

I get correct results for the two expressions that you've shown as error.

5+ +6 displays in history as 5+6, and Ans(1) = 11. (Note I inserted a space between the two plus signs, to clarify that the 6 has a positive symbol).

5--6 Uses the subtraction sign after the 5 and the negative sign preceding the 6 to also result in Ans(1)=11. It's not clear in this posting that the 6 has the negation symbol, from the [+/-] button, for example. However, the Prime display shows that the negation symbol is smaller than the minus symbol.
(04-07-2015 05:09 PM)DrD Wrote: [ -> ]
(04-07-2015 04:36 PM)compsystems Wrote: [ -> ]5++6 // error
5--6 // error

I get correct results for the two expressions that you've shown as error.

5+ +6 displays in history as 5+6, and Ans(1) = 11. (Note I inserted a space between the two plus signs, to clarify that the 6 has a positive symbol).

5--6 Uses the subtraction sign after the 5 and the negative sign preceding the 6 to also result in Ans(1)=11. It's not clear in this posting that the 6 has the negation symbol, from the [+/-] button, for example. However, the Prime display shows that the negation symbol is smaller than the minus symbol.

Not so on 50G - between ' ' two subtracts are allowed eg '5--6'.
(04-07-2015 04:36 PM)compsystems Wrote: [ -> ]5++6 // error
5--6 // error

Since the CAS interprets n++ and n-- as increment and decrement (kind of like C), perhaps 5++ is parsed as incrementing 5, thus causing an error.
5+ SPC +6 => 11 OK
5- SPC -6 => 11 OK

Where is the information to use the +, -, ++, -- operator?, some of my classmates who bought the hpprime are disappointed that no information as hpprime works, without documentation we have to guess.
Please HPPrime TEAM complete catalog help

NOW with − as sign /!\ ASC("−") = 8722 the command should be called Unicode() and non-ASCII ASC()

−−6 => 6 ok
−+6 => -6 ok
5-−6 => 11 ok

5▶x
x++ => 6 ok
x-- => 5 ok

--x => ERROR
++x => ERROR

And not say what type of error, it is necessary to clearly define the errors displayed on screen, not only display an icon of (X) with the input typed in the input line.

All power calculator is lost in these bit details
Reference URL's