Proof of X≤Y inverse to X˃Y

09012018, 08:40 AM
(This post was last modified: 09012018 08:52 AM by Gamo.)
Post: #1




Proof of X≤Y inverse to X˃Y
HP12C only got two conditional test of [X≤Y] and [X=0]
Recently I try to do the inverse of the [X≤Y] to [X˃Y] To get [X˃Y] this must use [X≤Y] three times. Here is the simple program to make this proof. Case 1. [X≤Y] If true result show 101 If false result show 1 Case 2. [X˃Y] If true result show 101 If false result show 1 101 for True 1 for False Procedure: Y [ENTER] X [R/S] > Case 1 Y [ENTER] X [R/S] > Case 2 Example: Y stack is 100 and X stack is 100 100 [ENTER] 100 [R/S] display 101 // [X≤Y] 100 ≤ 100 that is TRUE 100 [ENTER] 100 [R/S] display 1 // [X˃Y] 100 ˃ 100 that is FALSE Y stack is 100 and X stack is 101 100 [ENTER] 101 [R/S] display 1 // [X≤Y] 101 ≤ 100 that is FALSE 100 [ENTER] 101 [R/S] display 101 //[X˃Y] 101 ˃ 100 that is TRUE Program: Conditional Test comparison between [X≤Y] and [X˃Y] Code:
This is just a curiosity. Is this really work as show in these example? Gamo 

09012018, 09:31 AM
Post: #2




RE: Proof of X≤Y inverse to X˃Y  
09012018, 10:10 AM
Post: #3




RE: Proof of X≤Y inverse to X˃Y
The OP seems to be under the impression that repeating a test instruction 3x equates to the inverse test. I've already debunked this on facebook but somehow the post seems to have disappeared!


09012018, 10:19 AM
(This post was last modified: 09012018 10:19 AM by pier4r.)
Post: #4




RE: Proof of X≤Y inverse to X˃Y
little request.
While facebook is great for immediate discussion (as other social networks), its ability to retrieve historical content converge to 0 quite fast (like after 23 days something was posted). And this is a community based on historical content. For posts that contain information or costed some effort, wouldn't be bad to share them also here. Wikis are great, Contribute :) 

09012018, 12:27 PM
Post: #5




RE: Proof of X≤Y inverse to X˃Y
(09012018 08:40 AM)Gamo Wrote: This is just a curiosity. Is this really work as show in these example? No. If you repeat a conditional three times, all you're accomplishing is to waste two lines. Consider: if the condition is true, by the doiftrue / skipiffalse rule, the second of the three conditionals will also be true, and the third, and finally the instruction after the third conditional is executed. If the condition is false, the second conditional is skipped, the third is executed, and since the condition is still false, the function after the third conditional is skipped. I'm not even going to try to pick apart that "example," since it seems designed to confuse, and I have a headache. 

09012018, 12:31 PM
Post: #6




RE: Proof of X≤Y inverse to X˃Y
(09012018 10:19 AM)pier4r Wrote: While facebook is great for immediate discussion (as other social networks), its ability to retrieve historical content converge to 0 quite fast (like after 23 days something was posted). Especially when said historical content has been deleted rather than just aged away. 

09012018, 12:57 PM
(This post was last modified: 09012018 01:13 PM by Gamo.)
Post: #7




RE: Proof of X≤Y inverse to X˃Y
To recap on this topic the main part of these two test difference is
1. X is less than or equal to Y 2. X is greater than Y Example with equal integers on stacks X and Y will get result with "less than or equal to" another is "greater than" When stacks X and Y are both 100 [X≤Y] 100 ≤ 100 is True [X˃Y] 100 ˃ 100 is False // This test will not use greater than or equal to When doing the inverse logic in program next line will be False follow by True 01 Inverse Logic 02 False 03 True I believe that it is sometime very handy to have this conditional test when needed. Gamo 

09012018, 02:04 PM
Post: #8




RE: Proof of X≤Y inverse to X˃Y
Gamo, why are lines 0917 in this program?


09012018, 07:51 PM
Post: #9




RE: Proof of X≤Y inverse to X˃Y
(09012018 08:40 AM)Gamo Wrote: Recently I try to do the inverse of the [X≤Y] to [X˃Y] No, this can and will not work. Three times the same test does exactly the same as one single test. So... X≤Y? X≤Y? X≤Y? ...is the same as a single X≤Y? test. Just with two wasted program lines. Do you want a proof? (09012018 12:57 PM)Gamo Wrote: When doing the inverse logic in program next line will be False follow by True To invert a test simply have it followed by another test that always is false. Your third step ("True") does not change anything and can be removed. Example: if you know that X definitely is not zero, the "always false" step can be "X=0?". This way... X≤Y? X=0? ...becomes an "X>Y?" test. BUT: On the 12C or other calculators with line addressing inverting a test can be done even easier: simply have the test followed by a GTO to the second next line. Code: 21 ... Of course you can also skip two or more lines. Example: if X>Y store R1 into R2. Code: 21 ... Dieter 

09012018, 08:27 PM
Post: #10




RE: Proof of X≤Y inverse to X˃Y
(09012018 07:51 PM)Dieter Wrote: BUT: On the 12C or other calculators with line addressing inverting a test can be done even easier: simply have the test followed by a GTO to the second next line. Gene: And the beauty of this (IMO) is that on a lineaddressing model with limited steps, it is VERY efficient. No step burned with a LBL. Of course... that's only true until you have to modify the program and then it really hurts. Or if you have a ton of memory! :) 

09022018, 01:29 AM
Post: #11




RE: Proof of X≤Y inverse to X˃Y
Dieter thank You
Your explanations is very clear and easy to understand. My proof is usually not work as expected. Thank You Gamo 

09022018, 01:52 PM
Post: #12




RE: Proof of X≤Y inverse to X˃Y
One more example for X>Y conditional test out of curiosity.
This program keep adding 1 and pause in X stack to compare with 10 in Y stack Procedure: Clear Register REG R/S > 1, 2, 3,...,10 then stop at 11 because 11 > 10 Program: Code:
Gamo 

09022018, 02:01 PM
Post: #13




RE: Proof of X≤Y inverse to X˃Y
(09022018 01:52 PM)Gamo Wrote: No it doesn't. Take a closer look at the order in which your numbers are in the stack. When execution reaches line 08, you have 10 in the Y register and your count in the X register. Of course you're going to keep counting with an X<=Y? command, it's blinking obvious. If line 08 to 10 equated to X>Y? then you wouldn't loop until your count exceeded 10. 

09022018, 02:07 PM
(This post was last modified: 09022018 02:08 PM by Dieter.)
Post: #14




RE: Proof of X≤Y inverse to X˃Y
(09022018 01:52 PM)Gamo Wrote: Gamo, it has just been shown that three consecutive tests do NOT invert it. So line 08 to 10 do NOT become an X>Y? test. They are exactly the same as one single X≤Y? test: Code: 05 1 The program works just because here NOT an X>Y? is required, but the correct test is X≤Y?. And that's what the program does: Three times X≤Y? is the same as a single X≤Y? test! I thought this was clear from the previous posts where this has been proven. Dieter 

09022018, 02:40 PM
(This post was last modified: 09022018 03:07 PM by Gamo.)
Post: #15




RE: Proof of X≤Y inverse to X˃Y
Oops my bad now that even more clear that it is really not work.
I did try the single X≤Y and result is the same. With X≤Y and X=0 together work on the same program that stop at 11. Thanks to Dieter and grsbanks to make this clear up. Thanks again Gamo 

09022018, 05:11 PM
(This post was last modified: 09022018 05:25 PM by Dieter.)
Post: #16




RE: Proof of X≤Y inverse to X˃Y
(09022018 02:40 PM)Gamo Wrote: I did try the single X≤Y and result is the same. Yes. More precisely: If you repeat the same test n times, the result is – the same as one single test if n is odd – always true if n is even, i.e. nothing is tested at all. (09022018 02:40 PM)Gamo Wrote: With X≤Y and X=0 together work on the same program that stop at 11. No. Try it and see what you get. Code: 01 CLX Note: R1 is cleared on start, so no Clear REG is required. What's the final number? [ ] 1 [ ] 10 [ ] 11 Check the correct answer. :) Dieter 

09022018, 05:43 PM
Post: #17




RE: Proof of X≤Y inverse to X˃Y
The previous posts have shown (and proven) that repeating the same test command multiple times makes no sense at all: If the number of repetitions is even the result is always "true", so nothing is tested at all; two consecutive X≤Y? test are the same as a NOP. If the number of repetitions is odd the result is the same as a single test. So three times X≤Y? is the same as one X≤Y?.
But there is one exception: there are test commands that alter the test condition. The most relevant example is the FS?C test (or F2? and F3? on the HP67/97 that do the same). Here testing a flag also clears that flag. This means that the next FS?C test always tests false, and the original test is inverted. So... FS?C 00 FS?C 00 ...is the same as FC?C 00 And on the HP67/97... F2? F2? ...is the same as FC?C 2. Otherwise repeating the same test does not make any sense at all. As explained above. Dieter 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)