cancel
Showing results for
Search instead for
Did you mean:
Highlighted
Tutor
11 7 2 1
Message 1 of 7
728
Flag Post
HP Recommended

Solved!

# HP Prime - getting HMS→() command to work in a program

HP Prime
Other

Does anyone know how to get the HMS→() command to work in a program?

I can get it to work on the stack.

On RPN stack
123d12'35"
(where d=character 60/176 (degree symbol), ' = char 2032/8242 "= char 2033/8243)
HMS->() ENTER
gives an answer of 123.2097222 , which is correct.

But in a program cannot get this to work - gives syntax error.

I tried this program:-
EXPORT DMS_toDecimal()
BEGIN
Local var1, IntegerDeg, Minutes, Seconds, var2, var3, var3dec;
Input (var1,"Convert DMS to decimal deg.", "DMS", "Enter DMS");
IntegerDeg := String(IP(var1));
Minutes := FP(var1) * 100 ;
Minutes := String(IP(Minutes)) ;
Seconds := String((FP(FP(var1) * 100))* 100) ;
var3 := IntegerDeg + "°" + Minutes + "′" + Seconds + "″";
// The line below is where I get a syntax error
// Have also tried
// var3dec := HMS→(var3) ;
// Have also tried
// var3dec := var3 HMS→() ;
// does not work
var3dec := HMS→(string(var3)) ;
PRINT () ;
// PRINT("Var3= " + var3) ;
PRINT(var1 + " DMS= " + var3dec + " dec.degrees");

END;

Appreciate any assistance with this.

Tags (4)
6 REPLIES 6
Grad Student
191 190 35 64
Message 2 of 7
706
Flag Post
HP Recommended

Solved!

## HP Prime - getting HMS→() command to work in a program

Hello,

No need to use strings, just stay with real numbers and do:

var3 := IntegerDeg + Minutes/60 + Seconds/3600;

HMS display is done through a flag attached to the number that indicates that it needs to be displayed in HMS format. The number is NOT modified internally to HMS format...

HMS-> and ->HMS are for setting/clearing this flag.

Cyrille

I am an HP Employee
PhD Student
708 700 110 163
Message 3 of 7
701
Flag Post
HP Recommended

Solved!

## HP Prime - getting HMS→() command to work in a program

So to be clear, math just "works" with DMS values. Trig functions, addition, multiplication, etc. ROUND( ), TRUCNC( ) and so on.

You do not need to covert it back and forth for 99% of what you want to use it for.

TW

Although I work for the HP calculator group as a head developer of the HP Prime, the views and opinions I post here are my own.
Tutor
11 7 2 1
Message 4 of 7
614
Flag Post
HP Recommended

Solved!

## HP Prime - getting HMS→() command to work in a program

Cyrille.

I am still having issues with this. The HP Prime is a lot different to the HP50 in the way it works, and is progammed.

I am a surveyor in Australia and as part of the learning curve for programming the HP Prime I am trying to work out how to create a program that simply takes the input of dd.mmss (dd = degrees, mm=minutes, ss=seconds) and converts it to decimal degrees.

The entry mode is set to RPN on the HP Prime.

On the HP Prime on the stack I can use the inbuilt HMS->() command but I need to manually enter the degrees symbol after the degrees, have no decimal point, manually enter the minutes symbol ' after the minutes and manually enter the " symbol after the seconds, but it is way to slow and cumbersome to do it.

On the HP50 and all the prior RPN HP calculators it was simply a matter of using the HMS-> command .

On the HP50 if I put 234.3000 on the stack (or in a program) and used the HMS-> command it would convert to 234.5000 - as simple as that.

Any help would be appreciated.

Tags (2)
Tutor
11 7 2 1
Message 5 of 7
613
Flag Post
HP Recommended

Solved!

## HP Prime - getting HMS→() command to work in a program

TW.

I am still having issues with this. The HP Prime is a lot different to the HP50 in the way it works, and is progammed.

I am a surveyor in Australia and as part of the learning curve for programming the HP Prime I am trying to work out how to create a program that simply takes the input of dd.mmss (dd = degrees, mm=minutes, ss=seconds) and converts it to decimal degrees.

The entry mode is set to RPN on the HP Prime.

On the HP Prime on the stack I can use the inbuilt HMS->() command but I need to manually enter the degrees symbol after the degrees, have no decimal point, manually enter the minutes symbol ' after the minutes and manually enter the " symbol after the seconds, but it is way to slow and cumbersome to do it.

On the HP50 and all the prior RPN HP calculators it was simply a matter of using the HMS-> command .

On the HP50 if I put 234.3000 on the stack (or in a program) and used the HMS-> command it would convert to 234.5000 - as simple as that.

Any help would be appreciated.

Tutor
11 7 2 1
Message 6 of 7
590
Flag Post
HP Recommended

Solved!

## HP Prime - getting HMS→() command to work in a program

Thanks for the assistance.

Grad Student
191 190 35 64
Message 7 of 7
565
Flag Post
HP Recommended

Solved!

## HP Prime - getting HMS→() command to work in a program

Hello,

I understand...

Prime is indeed different from the 50G and some of the ways to do things are different.

HMS is one of them where the HMS display is only a "display" attribute, not a change in the number.

Cyrille

I am an HP Employee
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation