HP Forums
Problems with signs law and other arithmetic operators - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Problems with signs law and other arithmetic operators (/thread-3581.html)



Problems with signs law and other arithmetic operators - compsystems - 04-07-2015 04:36 PM

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


RE: Problems with signs law and other arithmetic operators - Gerald H - 04-07-2015 04:52 PM

Don't know why you wanted to try these expressions - HP 50G returns same results as you quote for MATLAB.


RE: Problems with signs law and other arithmetic operators - Marcio - 04-07-2015 04:56 PM

And so does the Prime in textbook and Algebraic modes.


RE: Problems with signs law and other arithmetic operators - DrD - 04-07-2015 05:09 PM

(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.


RE: Problems with signs law and other arithmetic operators - Gerald H - 04-07-2015 05:51 PM

(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'.


RE: Problems with signs law and other arithmetic operators - Wes Loewer - 04-07-2015 06:13 PM

(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.


RE: Problems with signs law and other arithmetic operators - compsystems - 04-07-2015 09:40 PM

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