Page 1 of 1

Turning the decimal point OFF

PostPosted: Sun Feb 21, 2021 9:45 pm
by ScottJ
I have a program that is obtaining and printing degrees, minutes, and seconds of lat/lon coordinates. I use decimal seconds to three places, but degrees and minutes are integers.

When I put these numbers into the alpha register for printing in FIX 0, the trailing decimal point remains. So the output string looks stupid: 78. 19. 10.354 NORTH

Short of doing string manipulation on each number, is there a way to turn OFF the radix marker altogether so integers look like integers?

Thanks in advance for any ideas.

Re: Turning the decimal point OFF

PostPosted: Sun Feb 21, 2021 10:26 pm
by dlachieze
CF 29 after FIX 0 will suppress the decimal point.

Re: Turning the decimal point OFF

PostPosted: Mon Feb 22, 2021 6:40 am
by ScottJ
dlachieze wrote:CF 29 after FIX 0 will suppress the decimal point.


Thanks much!

Re: Turning the decimal point OFF

PostPosted: Sun Mar 07, 2021 3:11 pm
by ScottJ
Worked perfectly! One more question: is there a quick and dirty way to add a leading zero? My test program output looks like the attached. The minutes look weird as single digits.

Re: Turning the decimal point OFF

PostPosted: Sun Mar 07, 2021 5:01 pm
by dlachieze
ScottJ wrote:One more question: is there a quick and dirty way to add a leading zero?

Assuming that the minutes are in the X register, you can insert the following instructions before the ARCL of the minutes value:

Code: Select all
10
x<=y?
GTO 01
CLX
ARCL ST X
LBL 01
RDN

Re: Turning the decimal point OFF

PostPosted: Wed Mar 10, 2021 1:50 am
by mike-stgt
dlachieze wrote:Assuming that the minutes are in the X register, [...]
... and assuming FIX 0 is already set and ScottJ uses an HP41CX or has at least plugged in a Time module I suggest to shorten the shown proposal to
Code: Select all
ATIME24

Otherwise, how about
Code: Select all
10
x>y?
"~0"
RDN

with "~0" connoting to append literal "0". (I am about to waste much more time with this append than the improvement could ever save.)

A clear word to ScottJ about the statement WITHIN 136.8 M -- even if the m stand for meter not miles, it is more than the longer side of a football/soccer field. For such a "precise" position fix the tolerance shown to the 1/10th of a meter is a bit too much meticulous. Same for the three decimals of the seconds. The earth's circumference is (according the original definition of the meter, over the poles) 40'000 km, divided by 360° is the "length" of one degree on the surface, divided by 60 the length of a minute (looks like a nautical mile), divided by 60 the length of one second, three decimal places depict a "granulation" of 1/1000th of it -- or less than 1/4000th of the 136.8 M variance.