Post Reply 
Number format toggle key
04-01-2020, 05:34 PM
Post: #1
Number format toggle key
I was very used to this function on my old Casio calculator, so i wrote a program to have it back in my HP Prime without the need to go into settings.
It works with alpha + ab/c but you can use the key you like the most, it also show a little message in te top left corner to tell you in which mode you are in. It toggles between std, sci, eng and flt because those were the ones i nedded.

KEY KA_Abc()
BEGIN
LOCAL name;
CASE
IF HFormat=0 THEN HFormat:=2; name:="SCI" END;
IF HFormat=2 THEN HFormat:=3; name:="ENG" END;
IF HFormat=3 THEN HFormat:=4; name:="FLT" END;
IF HFormat=4 THEN HFormat:=0; name:="STD" END;
DEFAULT
END;
STARTVIEW(-1,1);
TEXTOUT_P(name,G0,2,22,2,RGB(255,200,0),25,RGB(60,60,60));
WAIT(.5);
END;
Find all posts by this user
Quote this message in a reply
04-01-2020, 06:11 PM
Post: #2
RE: Number format toggle key
(04-01-2020 05:34 PM)RocaSeba Wrote:  I was very used to this function on my old Casio calculator, so i wrote a program to have it back in my HP Prime without the need to go into settings.
It works with alpha + ab/c but you can use the key you like the most, it also show a little message in te top left corner to tell you in which mode you are in. It toggles between std, sci, eng and flt because those were the ones i nedded.

KEY KA_Abc()
BEGIN
LOCAL name;
CASE
IF HFormat=0 THEN HFormat:=2; name:="SCI" END;
IF HFormat=2 THEN HFormat:=3; name:="ENG" END;
IF HFormat=3 THEN HFormat:=4; name:="FLT" END;
IF HFormat=4 THEN HFormat:=0; name:="STD" END;
DEFAULT
END;
STARTVIEW(-1,1);
TEXTOUT_P(name,G0,2,22,2,RGB(255,200,0),25,RGB(60,60,60));
WAIT(.5);
END;

That's pretty cool and I was missing something like that. Casio does a great job with this.

How do I install/run it? (noob here)

Thanks
Find all posts by this user
Quote this message in a reply
04-01-2020, 06:27 PM
Post: #3
RE: Number format toggle key
(04-01-2020 06:11 PM)Dands Wrote:  That's pretty cool and I was missing something like that. Casio does a great job with this.

How do I install/run it? (noob here)

Thanks

You're welcome!

You just have to create a new program and copy the code inside (i recommend using the connectivity kit), then you go to the home screen and enable the user keys pressing shift+help (do it twice if you want them to stay enable) and that's it!
Find all posts by this user
Quote this message in a reply
04-01-2020, 07:34 PM
Post: #4
RE: Number format toggle key
(04-01-2020 06:27 PM)RocaSeba Wrote:  
(04-01-2020 06:11 PM)Dands Wrote:  That's pretty cool and I was missing something like that. Casio does a great job with this.

How do I install/run it? (noob here)

Thanks

You're welcome!

You just have to create a new program and copy the code inside (i recommend using the connectivity kit), then you go to the home screen and enable the user keys pressing shift+help (do it twice if you want them to stay enable) and that's it!

Ok great. So I have this number in my Home, selected the value and pressed Alpha + ab/c and this orange zero showed in the top left corner very quickly. The value wasn't converted. Am I doing it wrong it should have cycled between notations?


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
04-01-2020, 08:20 PM
Post: #5
RE: Number format toggle key
(04-01-2020 07:34 PM)Dands Wrote:  Ok great. So I have this number in my Home, selected the value and pressed Alpha + ab/c and this orange zero showed in the top left corner very quickly. The value wasn't converted. Am I doing it wrong it should have cycled between notations?

That's because the program only works if you are in standard, scientific, engineering or floating format, if you are in another one the variable name si set to zero and nothing happens, if you want i could adapt the program to cycle all the number formats!
Find all posts by this user
Quote this message in a reply
04-01-2020, 10:51 PM (This post was last modified: 04-03-2020 04:21 PM by Dands.)
Post: #6
RE: Number format toggle key
(04-01-2020 08:20 PM)RocaSeba Wrote:  
(04-01-2020 07:34 PM)Dands Wrote:  Ok great. So I have this number in my Home, selected the value and pressed Alpha + ab/c and this orange zero showed in the top left corner very quickly. The value wasn't converted. Am I doing it wrong it should have cycled between notations?

That's because the program only works if you are in standard, scientific, engineering or floating format, if you are in another one the variable name si set to zero and nothing happens, if you want i could adapt the program to cycle all the number formats!

Ok now it worked. It's a cool program, but you know what would be much nicer for us engineers?

You could implement something like the ENG key in Casio calculators that will change the format to 10E0, 10E3, 10E6 and 10E9 (and negative exponents too). This is useful because if you get a result, i.e., 5E2 you can easily change it to 500E0, 0.5E3, etc. You must be able to cycle through these, though.

You could program the EEX key to go forward and some other key to go backwards, just like the Casio.

This would be great. Smile

edit

Some guys already tried it:

https://www.hpmuseum.org/forum/thread-5039.html
Find all posts by this user
Quote this message in a reply
Post Reply 




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