HP Forums
Evolution of Conditional Tests - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Evolution of Conditional Tests (/thread-14307.html)



Evolution of Conditional Tests - David Hayden - 01-03-2020 09:28 PM

I noticed recently that the conditional tests available on the programmable models changed over the years. Here they are in roughly chronological order from the 65 to the 15C:
Code:
    x<y x<0  x<=y x<=0  x>y x>0  x>=y x>=0  x!=y x!=0  x=y x=0
65             Y         Y                    Y         Y
55             Y                                        Y
67       Y     Y         Y   Y                Y    Y    Y   Y   ( x=y and x=0 added thanks to Dave Britten's reply below.)
25   Y   Y                         Y    Y     Y    Y    Y   Y
29C      Y     Y         Y   Y                Y    Y    Y   Y
33C      Y     Y         Y   Y                Y    Y    Y   Y
34C      Y     Y         Y   Y                Y    Y    Y   Y
38C            Y                                            Y
41C  Y   Y     Y    Y    Y   Y                Y    Y    Y   Y
10C            Y                                            Y
11C      Y     Y         Y   Y                Y    Y    Y   Y
15C  Y   Y     Y    Y    Y   Y     Y    Y     Y    Y    Y   Y
It's particularly interesting to me to see how things changed from the 67 to the 25 to the 29C. And look at how the 25 was the only calculator with an x<y test until the 41C. The others all used x<= y. Instead of x>y and x>0, the 25 had x>=y and x>0, functions that wouldn't appear again until the 15C. I wonder why HP kept changing their mind.


RE: Evolution of Conditional Tests - Dave Britten - 01-03-2020 09:36 PM

Small correction: the 67 does have x=0 and x=y, for a total of 8 comparison tests.


RE: Evolution of Conditional Tests - Thomas Okken - 01-03-2020 11:41 PM

My guess would be that they provided eight tests on most of the early calculators because that number could be placed on the keyboard reasonably elegantly, and the choice of which tests were provided probably went something like this: for the comparisons between X and Y, provide one strict and one non-strict inequality, so the missing two can be easily synthesized by swapping X and Y; for the comparisons between X and 0, provide only strict inequalities, because those are used more often than the non-strict ones. N.B. I don't have any inside information on this, I'm just guessing... the differences between the comparison operators are something that I have wondered about many times, and of course they are something one tends to run into when porting programs from one calculator to another!

The HP-25 is the odd one out with its choice of inequalities, because they were running out of ROM space. Making the X vs. Y comparisons exactly match the X vs. 0 comparisons saved a few bytes of code in their implementation. Smile


RE: Evolution of Conditional Tests - rprosperi - 01-03-2020 11:48 PM

(01-03-2020 09:28 PM)David Hayden Wrote:  It's particularly interesting to me to see how things changed from the 67 to the 25 to the 29C. And look at how the 25 was the only calculator with an x<y test until the 41C. The others all used x<= y. Instead of x>y and x>0, the 25 had x>=y and x>0, functions that wouldn't appear again until the 15C. I wonder why HP kept changing their mind.

Intro Dates:

HP-25: 1975-8-1
HP-67: 1976-7-1
HP-29C: 1977-7-1

So at least for these three models (and noting Dave's correction) they really only changed their mind once.

I too used to instinctively react thinking the 67 came out before the 25; it was a similar discussion here a couple years ago that made me research the dates to better understand. It also answers why the 29C seems so different from the 25, but not really not so different from the 67.


RE: Evolution of Conditional Tests - Dave Britten - 01-04-2020 12:08 AM

The Pioneers are pretty indecisive on this matter too:

20S, 21S: x<=y, x=0
32S: x!=y, x<y, x>y, x=y, x!=0, x<0, x>0, x=0 (No <= or >= comparisons!)
42S: All 12 comparisons present
32SII: All 12 comparisons present


RE: Evolution of Conditional Tests - Valentin Albillo - 01-04-2020 12:26 AM

(01-04-2020 12:08 AM)Dave Britten Wrote:  The Pioneers are pretty indecisive on this matter too:

20S, 21S: x<=y, x=0
32S: x!=y, x<y, x>y, x=y, x!=0, x<0, x>0, x=0 (No <= or >= comparisons!)
42S: All 12 comparisons present
32SII: All 12 comparisons present

The subject could be extended to also list the tests which work with alphanumerics in those models having them.

For instance, perhaps X=Y? works for either numbers or alpha strings while X<Y? may or may not work with alpha strings (which would allow sorting easily).

Thus, I suggest to expand the table to include tests which do work with alpha data in models having alpha capabilities. It would be informative and can include a surprise or two.

V.


RE: Evolution of Conditional Tests - Dave Britten - 01-04-2020 12:33 AM

(01-04-2020 12:26 AM)Valentin Albillo Wrote:  
(01-04-2020 12:08 AM)Dave Britten Wrote:  The Pioneers are pretty indecisive on this matter too:

20S, 21S: x<=y, x=0
32S: x!=y, x<y, x>y, x=y, x!=0, x<0, x>0, x=0 (No <= or >= comparisons!)
42S: All 12 comparisons present
32SII: All 12 comparisons present

The subject could be extended to also list the tests which work with alphanumerics in those models having them.

For instance, perhaps X=Y? works for either numbers or alpha strings while X<Y? may or may not work with alpha strings (which would allow sorting easily).

Thus, I suggest to expand the table to include tests which do work with alpha data in models having alpha capabilities. It would be informative and can include a surprise or two.

V.

That's a good point, though I think that only applies to the 41 and 42, correct? The 41 has real numbers and alpha strings, and the 42 adds matrices and complex numbers to that. Then you've also got the 15C with its matrix descriptors that can go on the stack, and I don't know how comparisons behave when you've switched the stack into complex mode.

The solver models (17B, 17BII, 27S, 18C, 19B, 19BII) I believe support all six comparison operators in solver equations, with comparisons between any pair of variables or constants. Not sure if the simpler equation solver in the 22S and 32SII supports any comparisons.


RE: Evolution of Conditional Tests - Sylvain Cote - 01-04-2020 12:58 AM

A little out of subject, but for the HP-41 the missing tests can be simulated:
Code:
X>=0?     X>=Y?       // missing test
INST.     INST.       // instruction to execute when the missing test is true
-----------------------------------------------------------------------------
X<0?      X<Y?        // reverse test
FS? 30    FS? 30      // always false (catalog in progress flag)
INST.     INST.       // instruction to execute when the missing test is true



RE: Evolution of Conditional Tests - Garth Wilson - 01-04-2020 03:44 AM

Now you just need to show the 41 with Angel's Warp_Core module! Big Grin


RE: Evolution of Conditional Tests - Sylvain Cote - 01-04-2020 04:22 AM

(01-04-2020 03:44 AM)Garth Wilson Wrote:  Now you just need to show the 41 with Angel's Warp_Core module! Big Grin
I am no match for the heavy artillery that you are bringing to the table. Wink
Garth is correct to mention the ultimate HP-41 ROM that Ángel has created.
Go see for yourself here: The Total_Rekall 2019 Module - RCL Math and Full Stack Tests for the HP-41 - Manual


RE: Evolution of Conditional Tests - Ángel Martin - 01-04-2020 07:03 AM

I agree the myriad of tests in the WARP_Core module exceed the intent of this task, but they certainly raise the ante quite a bit. After all it was dubbed "Dare to Compare" ROM for a good reason.

Lest to forget that with the Formula Evaluation ROM you can "design" your own test function, for instance "SQRT(Z+T)<= e^(X-pi.Y) if such a thing suits your fancy ;-)

Cheers,
ÁM


RE: Evolution of Conditional Tests - J-F Garnier - 01-08-2020 11:11 AM

I always wondered why the 29C tests were so different from the 25/25C, but taking into account the intro date, it makes sense. The comparison tests of the 29C were aligned with the 67 and then adopted for the series 30.


(01-04-2020 12:58 AM)Sylvain Cote Wrote:  A little out of subject, but for the HP-41 the missing tests can be simulated:
Code:
X>=0?     X>=Y?       // missing test
INST.     INST.       // instruction to execute when the missing test is true
-----------------------------------------------------------------------------
X<0?      X<Y?        // reverse test
FS? 30    FS? 30      // always false (catalog in progress flag)
INST.     INST.       // instruction to execute when the missing test is true

Same trick can be used to port a 25/25C program using its specific tests to the HP67/29/33/34/11.
Code:
HP25  HP67/29/33/34/11
X>=0?     X<0?
INST.     X=0?
          INST.

But what about the X>=Y? and X<Y? tests that have no reverse on the HP67/29/33/34/11 ?
There is a 3-step solution for X>=Y? :
Code:
HP25  HP67/29/33/34/11
X>=Y?     X<=Y?
INST.     X=Y?
          INST.

J-F