Turning the decimal point OFF

Turning the decimal point OFF

Postby ScottJ » Sun Feb 21, 2021 9:45 pm

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.
ScottJ
.....
.....
 
Posts: 15
Joined: Fri Feb 12, 2021 1:08 am

Re: Turning the decimal point OFF

Postby dlachieze » Sun Feb 21, 2021 10:26 pm

CF 29 after FIX 0 will suppress the decimal point.
dlachieze
......
......
 
Posts: 23
Joined: Wed Mar 11, 2009 9:39 am

Re: Turning the decimal point OFF

Postby ScottJ » Mon Feb 22, 2021 6:40 am

dlachieze wrote:CF 29 after FIX 0 will suppress the decimal point.


Thanks much!
ScottJ
.....
.....
 
Posts: 15
Joined: Fri Feb 12, 2021 1:08 am

Re: Turning the decimal point OFF

Postby ScottJ » Sun Mar 07, 2021 3:11 pm

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.
Attachments
1D78E094-DE99-4EA6-B96F-6D2790BDF47D.jpeg
ScottJ
.....
.....
 
Posts: 15
Joined: Fri Feb 12, 2021 1:08 am

Re: Turning the decimal point OFF

Postby dlachieze » Sun Mar 07, 2021 5:01 pm

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
dlachieze
......
......
 
Posts: 23
Joined: Wed Mar 11, 2009 9:39 am

Re: Turning the decimal point OFF

Postby mike-stgt » Wed Mar 10, 2021 1:50 am

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.
mike-stgt
.........
.........
 
Posts: 77
Joined: Tue Dec 24, 2019 12:12 pm


Return to Programming

Who is online

Users browsing this forum: Semrush [Bot] and 1 guest