The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Base conversion program.
07-05-2015, 06:34 PM (This post was last modified: 07-05-2015 11:51 PM by TechAlex.)
Post: #1
Base conversion program.
I am new to the HP Prime, I got mine about a month ago. One thing I do like about the HP Prime is that is very easy to program it. The HP Prime itself together with the Virtual HP Prime and the connectivity kit, in my opinion is the best combination. You are in control of this number eating machine.

I had for many years the 48SX, finally the "ON" key gave up.

Anyway, I read that the HP Prime sucks regarding base conversion, and I agree on that. I thought, a small program will take care of that, here it is based on SETBASE. (Page 544)

// HP Prime Base Conversion.
// Alex Rodriguez - 2015
EXPORT Base_Conversion()
BEGIN
LOCAL X,bin,oct,dec,hex;
INPUT(X, "Enter number to convert:");
bin:=SETBASE(X,1); // e.g. #0101110b
oct:=SETBASE(X,2); // e.g. #2345o
dec:=SETBASE(X,3); // For base 10, Enter number as usual.
hex:=SETBASE(X,4); // e.g. #456ABCDh, pay attention to the upper case.
PRINT();
PRINT("Here is the conversion regardless of what
base the Prime is set to:");
PRINT(" ");
PRINT("Binary number " +bin);
PRINT("Octal number " +oct);
PRINT("Decimal number" +dec);
PRINT("Hex number " +hex);
END;


Alex
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Base conversion program. - TechAlex - 07-05-2015 06:34 PM
RE: Base conversion program. - eried - 07-06-2015, 12:49 PM
RE: Base conversion program. - TechAlex - 07-06-2015, 10:57 PM
RE: Base conversion program. - Tim Wessman - 07-06-2015, 11:32 PM
RE: Base conversion program. - TechAlex - 07-07-2015, 12:00 AM
RE: Base conversion program. - Tim Wessman - 07-07-2015, 01:57 PM
RE: Base conversion program. - TechAlex - 07-06-2015, 10:58 PM
RE: Base conversion program. - douganc - 07-06-2015, 11:41 PM
RE: Base conversion program. - eried - 07-07-2015, 03:13 AM
RE: Base conversion program. - Angus - 07-07-2015, 07:51 AM



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