cancel
Showing results for 
Search instead for 
Did you mean: 
  • ×
    Information
    Know the Benefits of your HP account

    Connect with HP support faster, manage all your devices in one place, view warranty information and more– Click Here

    Information
    Fix Windows 10 Update Issues

    Resolve Windows 10 or update issues on HP computer or printer– Click Here

  • post a message
  • ×
    Information
    Know the Benefits of your HP account

    Connect with HP support faster, manage all your devices in one place, view warranty information and more– Click Here

    Information
    Fix Windows 10 Update Issues

    Resolve Windows 10 or update issues on HP computer or printer– Click Here

  • post a message
Highlighted
Level 2
11 7 2 1
Message 1 of 7
1,169
Flag Post

Solved!

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

HP Recommended
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.

6 REPLIES 6
Highlighted
Level 6
Level 6
252 251 42 77
Message 2 of 7
Flag Post
HP Recommended

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
0 Kudos
Highlighted
Level 8
Level 8
746 743 121 184
Message 3 of 7
Flag Post
HP Recommended

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.
0 Kudos
Highlighted
Author
Level 2
11 7 2 1
Message 4 of 7
Flag Post
HP Recommended

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.

 

0 Kudos
Highlighted
Author
Level 2
11 7 2 1
Message 5 of 7
Flag Post
HP Recommended

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.

 

0 Kudos
Highlighted
Author
Level 2
11 7 2 1
Message 6 of 7
Flag Post
HP Recommended

Thanks for the assistance.

0 Kudos
Highlighted
Level 6
Level 6
252 251 42 77
Message 7 of 7
Flag Post
HP Recommended

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
0 Kudos
Warning Be alert for scammers posting fake support phone numbers and/or email addresses on the community. If you think you have received a fake HP Support message, please report it to us by clicking on "Flag Post".
† 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