base conversion problems...
|
09-01-2017, 10:24 AM
Post: #1
|
|||
|
|||
base conversion problems...
Converting between bases is something I need to do a lot of in embedded software. However, the HP prime makes it difficult. I don't have a problem with converting from other bases to decimal, but converting from decimal to other bases is the problem. Sure I can use convert, but thats way way too much work.
I tried highlighting a result and using shift-base (integer editor), but I can't seem to edit in any format other than the default base (which is set to hex).....as this is the most common base I use apart from decimal. Also, I read somewhere that the highlighted value should appear in the integer editor, but it doesn't. Is there a fast way to convert from decimal to hex....it's such a fundamental operation that if it isn't there, it needs to be??????????? On just about every other calculator in the world, there are hex,oct,bin,dec buttons or menu options, and you type your number and hit the button and the number is converted....try it on the TI calculators.....you'll see what I mean.... It should be possible to convert from any base to any other base in 2 key presses. I don't mind typing #23h, but I need a way to convert that to any other base quickly. I don't even mind using an integer editor, if I can edit in any base...however, I think you'd be better off dumping the integer editor and putting in a menu with hex,oct,bin,dec functionality. Thx -frustrated |
|||
09-01-2017, 11:47 AM
Post: #2
|
|||
|
|||
RE: base conversion problems...
I did discover R->B, which is too much to type for the frequency with which I do these conversions. Currently I'm using my old TI86 or an app on my phone to do conversions as the prime is too cumbersome.
I also discovered how to get a decimal number into the integer editor. You have to enter it in the format #43d hit enter, and enter the integer editor. If I'd just had 43 on the stack, the editor doesn't open and the # character appears on the input line. Unfortunately, edit inside the editor only allows the current base (hex for me)....when it really should do it in whatever you change the base to be. I'm really surprised the prime has made base conversion so cumbersome. Maybe I'll write a program to produce the menu method and change the definition of the base key... I'd highly recommend changes in this area for a future release of the firmware. Thx -D |
|||
09-01-2017, 05:24 PM
Post: #3
|
|||
|
|||
RE: base conversion problems...
Base conversion works just fine for me.
Insider the editor, +- cycles through the bases, regardless of what your default base is. I don't understand why you would be stuck in hex. Also, what could be easier than R->B()? What is too much typing? Or create a user function called RB (either as a program, or via the Define setup). |
|||
09-02-2017, 03:23 AM
Post: #4
|
|||
|
|||
RE: base conversion problems...
R->B() is too much typing. I do conversions like you use the x sign. It'd be like you having to look up multiply in the catalog....you'd find that annoying right? People doing embedded development often end up having to do loads of base conversions while debugging their assembly language code. Most advanced calculators have menus like I suggested. I really don't care about the mechanism, but I need to be able to convert quickly.
The editor....here is my problem. I enter the editor....now lets say I want to convert 43d to hex.....If I rotate the base to decimal inside the editor....any number I type only shows up in the hex field....not the decimal field. Thx -D |
|||
09-02-2017, 05:34 AM
Post: #5
|
|||
|
|||
RE: base conversion problems...
Call the editor after putting #43d into the history of the home screen -- then rotate +. Ok. #2Bh.
Or define user function RB as R->B(X). RB(43) returns #2Bh. Super easy. |
|||
09-02-2017, 05:58 AM
Post: #6
|
|||
|
|||
RE: base conversion problems...
The HP Prime has a USER MODE which allows the user to assign functions and programs to keys, thus making it possible to do anything you want in the fewest possible keystrokes. If your favorite function takes more keystrokes than you'd like, just assign it to a key, and from now on it's available in ONE keystroke. Don't like the interface? Prime is programmable. Write your own. Then assign it to a key.
In other words, we all have three options available to us. (1) Bemoan the fact that the gravel hurts our bare feet. (2) Demand that the world pave itself. (3) Put on shoes. <0|ɸ|0> -Joe- |
|||
09-02-2017, 08:27 AM
(This post was last modified: 09-02-2017 09:29 AM by Stevetuc.)
Post: #7
|
|||
|
|||
RE: base conversion problems...
Take a look at baseconv in the program section (scroll to end of post for latest code) - it uses a simple menu system. If you are in rpn mode you can place the input on stack and then run baseconv(). You could assign baseconv() to a userkey or access from user menu.
Input without a "#" is accepted as decimal whatever integer mode you are in. Example: Enter 255 onto stack (I'm assuming Rpn mode) baseconv() <enter> Press enter again to accept System base and again for System size And you get result #FFh |
|||
09-02-2017, 10:15 AM
Post: #8
|
|||
|
|||
RE: base conversion problems...
User mode and baseconv sound like they'll do the job. Let me give those a shot!
Thx -D |
|||
09-02-2017, 08:35 PM
(This post was last modified: 09-02-2017 08:43 PM by Stevetuc.)
Post: #9
|
|||
|
|||
RE: base conversion problems...
The prog given here might work even better- 1 tap conversion when in locked user and Rpn mode
![]() http://www.hpmuseum.org/cgi-sys/cgiwrap/...ead=252437 Code:
This code is what I ended up using. With user mode locked on and #num in stack press Base (-) key then tap the menu for desired conversion - simples! |
|||
09-03-2017, 02:07 AM
Post: #10
|
|||
|
|||
RE: base conversion problems...
Yeah, I realize I'm going to need to create my own conversion program. I notice that the # char is also available as the key Alpha-3, so the integer editor can be overwritten in User mode.
I'm mulling over a few different ways to do it. I'm thinking that maybe the best way would be to type Shift-Base and have that run a program that takes the input line and convert it into hex, decimal, octal and binary and store the results in the global variables H, D, O and B respectively. This is probably the most convenient way to do manual conversions. |
|||
09-04-2017, 07:41 PM
Post: #11
|
|||
|
|||
RE: base conversion problems...
(09-02-2017 05:58 AM)Joe Horn Wrote: The HP Prime has a USER MODE which allows the user to assign functions and programs to keys, thus making it possible to do anything you want in the fewest possible keystrokes. If your favorite function takes more keystrokes than you'd like, just assign it to a key, and from now on it's available in ONE keystroke. Don't like the interface? Prime is programmable. Write your own. Then assign it to a key. I have yet to see the world pave itself. |
|||
09-05-2017, 07:05 AM
Post: #12
|
|||
|
|||
RE: base conversion problems...
The programming has its restrictions. Especially when it comes to the topics webmasterpdx is talking about in his posts. And there are issues with convenience, productivity and keystrokes from time to time.
Although I am surely not fully qualified to talk about the programming and customization of the prime, I notice that there are still flaws and drawbacks. Quote:The HP Prime has a USER MODE which allows the user to assign functions and programs to keys, thus making it possible to do anything you want in the fewest possible keystrokes. If your favorite function takes more keystrokes than you'd like, just assign it to a key, and from now on it's available in ONE keystroke. Don't like the interface? Prime is programmable. Write your own. Then assign it to a key. (4) get leather and tools and learn how to craft shoes....... ;-) (5) shoot cows, learn skinning goto (4) Don't make things too easy for HP. A company should try to offer the best possible sollutions and not hide behind such things. That leads to reputation in a competing market. |
|||
09-05-2017, 08:26 AM
(This post was last modified: 09-05-2017 08:38 AM by webmasterpdx.)
Post: #13
|
|||
|
|||
RE: base conversion problems...
I have a decent program for converting bases. I overloaded the # key (shift-3) in user mode. Note that there are problems with overloading the shift-minus (base function) which is unreliable, but shift-3 is reliable.
This must be run in Home mode as you can't push numbers of the form #nnb on the CAS stack. So to use, you'd put it in Home mode, Enter your number and hit enter to push it onto the stack. Then shift-user, alpha-3 will run the program. Select the base you want to convert to via the menu. The program will exit itself. It's pretty quick and easy to use. First, here are some utility functions I use, including the key definition. Code:
And here is the base conversion program itself. Code:
Enjoy... |
|||
09-05-2017, 08:52 AM
Post: #14
|
|||
|
|||
RE: base conversion problems...
With respect to the comment above my last one, the prime is a very powerful calculator, but it needs nicer wrappers to get at the great features. e.g. The menu stuff should have the functions I use in the program above...that's a perfect example. There is a terminal output....they should provide a terminal window with scrollbar and the ability to both do input and output via the terminal....kind of like stdout in an xview window. There are a lot of applications where all you want is text, and the terminal provides the perfect conduit to produce these utilities. There are a bunch of stuff like this I'd love to see and wouldn't add much to the firmware. Also better coexistance between the CAS and HOME views. In fact, because the CAS stuff is transferred from XCas, perhaps the best way to do this is to make the entire home system work with the CAS i/o.
I'm fairly new to the prime....just got it a month or two ago, and it definitely requires getting used to. Calculators are kind of a ripoff, as you can get an app for a tablet for much less money. However, I love the feel of a calculator and when you are intimate with it, they can be very productive tools. So, it's important that HP keeps this product alive. It's also important that they realize that students are not the only customers. I'm really tired of hearing "we won't add that feature as it could allow students to get around exam mode".....maybe the solution is to have 2 calculators...one for students and a "pro" version for professionals. Finally, I gotta mention this. I find it very annoying that I have to use a flashlight to see the keys because of the poor choice of colors. I sure hope the person who came up with those is no longer employed at HP. Also, they need to assign a different hardware number to the version with the darker keys. I was unable to purchase one (even though it was on the market) as the sales people at HP dont' know their own products so when I tried to order it that way, they said what you buy is what you get, and they had no way to distinguish between the dark keys and light ones....I was unable to find a local store at the time with the dark keys.....so I run my calculator with a book light to see the keys. :-) |
|||
09-05-2017, 11:29 AM
(This post was last modified: 09-05-2017 01:04 PM by Stevetuc.)
Post: #15
|
|||
|
|||
RE: base conversion problems...
(09-05-2017 08:26 AM)webmasterpdx Wrote: I have a decent program for converting bases... A couple of changes I made to my version allow the function MBase() to be also usable from the command line using passed parameter in both rpn and algebraic/textbook In the base conversion program: EXPORT MBase(in) ... RETURN s:=SETBASE(in,s-1); In the key definitions: ... RETURN STRING(EVAL(MBase(Ans(1)))); It may be useful to some.. |
|||
09-05-2017, 11:09 PM
Post: #16
|
|||
|
|||
RE: base conversion problems...
I'll have to play around with that...good idea Steve...
Thx -Donald |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)