Post Reply 
(10C or 25C) Distance Speed Time
05-18-2024, 09:21 AM (This post was last modified: 05-18-2024 09:46 AM by C.Ret.)
Post: #7
RE: (10C or 25C) Distance Speed Time
(05-14-2024 04:03 AM)Gamo Wrote:  Your routine some data is not intact when input the two
variables and zero on the unknown. When making data
change the answer is wrong.

This remark is entirely relevant. I am a very lazy programmer and to save a ridiculous byte, I used the R2 register to store the converted time xor the speed by performing a subtraction in order to use the sign as the signal for the final conversion. This explains why my code gives erroneous results if the user does not restore the value in register R2.
I could have used another register, but that would have made the code a little longer. Unlike Thomas, I didn't have the brilliant idea of using the LASTx register to memorize one of the non-zero parameters.

I must admit that Thomas's latest version is the best compromise using the four registers without modifying the three data input ones.


01: 24 02    :   RCL 2      // Speed
02: 24 03    :   RCL 3      // Time (h.mms)
03: 15 00    : g →H         // convert Time to h.hhh
04: 61      :    ×         // compute distance and store decimal Time in the LASTx register
05: 15 61    : g x≠0       
06: 13 00    :   GTO 00     // Display computed Distance
07: 24 01    :   RCL 1      // Distance
08: 24 02    :   RCL 2      // Speed (or zero)
09: 14 73    : f LASTx       // Time (h.hhh) (or zero)
10: 41      :    -
11: 71      :    ÷        // Compute Time XOR negated Speed
12: 15 51    : g x≥0
13: 14 00    : f →H.MS      // back-convert Time
14: 15 03    : g ABS       // make Speed positive
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(10C or 25C) Distance Speed Time - Gamo - 05-13-2024, 10:43 AM
RE: (10C or 25C) Distance Speed Time - C.Ret - 05-18-2024 09:21 AM



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