I cant remember how I did it on the 50g
#1

Hi,

I know. The manuals refer to integer manipulation only of non-base 10 numbers. BUT, I remember I found a quick way to convert #.011b to #.375d (or vice-versa). I remember because I thought to myself at the time that "I'll have to remember this". But it's final time (home study) and I forgot. Any Ideas?

As always - THANKS,

Ken

#2

Put the calculator in BASE mode (Orange_shift BASE (over the 3)). Then the Fx keys can switch between the 4 different display formats Hex(F1), Dec(F2), Oct(F3) and Bin(F4). This will change the display of all numbers that are displayed with #xxxxxb.

#3

Hi again Ken,

This method will work, although it can get a bit tedious...

To convert from a binary fraction to a decimal fraction:

Let's use your example of #.011b: Multiply the binary fractional number by the power of 2 necessary to move the point to the right of the rightmost digit. In our case we need to move the point three places to the right, so we multiply by 2^3, which gives us
#11b. Use the calc to convert this to decimal, which yields 3.
Divide this by 2^3 (to remove it) and we get .375 .

Going the other way is essentially the reverse of the above, take your decimal fraction and start multiplying by increasing powers of 2 until it's an integer (just start hitting 2 multiply while keeping count)...in our case .375 becomes an integer (3) after being multiplied by 2^3 (8). Convert to binary and divide by 2^3 by sliding the point three places to the left.

If your decimal fractional number won't convert to a pure integer by multiplying by increasing powers of two (and most won't), you're looking at a repeating binary fractional number. Carry out the powers of 2 multiplication until you feel you have enough accuracy (2^13 seems like a good place to stop). Example:
To convert .6 decimal to binary: .6 ENTER, 2 multiply repeatedly while counting. Stop at 13 reps (2^13). display reads 4915.2. Convert to binary (calc will round off fractional part of number) to get #1001100110011b, divide by 2^13 by sliding point 13 places to the left to get #.1001100110011...b.

You could write subroutines to help with the tedious aspects of this, but I'll leave that to you.

Best regards, Hal

#4

There's nothing built in, but I've got a small program that can do these conversions. It's rather unsophisticated, and does no error checking, so garbage in, garbage out, as they say. It'll handle negative numbers; simply include a minus sign as the first character in your string. Either key the program in manually, or transfer with Kermit in ASCII mode.



3: Source base (Real)

2: Destination base (Real)

1: Number (String)

%%HP: T(3)A(R)F(.);
\<<
\<< NUM
IF DUP 64. >
THEN 55. -
ELSE 48. -
END
\>>
\<<
IF DUP 9. >
THEN 55. +
ELSE 48. +
END CHR
\>> 0. 0. 0. 0. 0. 0. 0. 0. \-> SB DB VS CVAL VALC V L DP R ST EN SG N
\<<
IF SB 10. ==
THEN VS OBJ\-> 'V' STO
IF V 0. <
THEN V NEG 'V' STO -1. 'SG' STO
ELSE 1. 'SG' STO
END
ELSE VS SIZE 'L' STO VS "." POS 'DP' STO
IF DP 0. \=/
THEN SB INV 'R' STO DP 1. + L
FOR x VS x DUP SUB CVAL EVAL R * V + 'V' STO R SB / 'R' STO
NEXT DP 1. - 'ST' STO
ELSE L 'ST' STO
END 1. 'R' STO
IF VS 1. 1. SUB "-" ==
THEN -1. 'SG' STO 2. 'EN' STO
ELSE 1. 'SG' STO 1. 'EN' STO
END ST EN
FOR x VS x x SUB CVAL EVAL R * V + 'V' STO R SB * 'R' STO -1.
STEP
END
IF SG -1. ==
THEN "-" 'VS' STO
ELSE "" 'VS' STO
END V LN DB LN / IP DB SWAP ^ 'R' STO 0. 'DP' STO
WHILE V .000000000001 >
REPEAT
IF R 0. > R 1. < AND DP 0. == AND
THEN VS "." + 'VS' STO 1. 'DP' STO
END V R / IP 'N' STO VS N VALC EVAL + 'VS' STO N R * V SWAP - 'V' STO R DB / 'R' STO
END VS
\>>
\>>

Checksum (from a 48GX): #EA1Eh

#5

Hi,

The problem with this is the 50g chokes on decimal points for non-decimal numbers.

Thanks

#6

Hey, how are you?

Yeah. This is what I am trying to avoid. It's a supervised exam with a time limit and I really don't wan't to waste time on fractional non-decimal number conversions. Especially when I WILL NEVER need to do this on the job (or elsewhere).

Thanks

#7

Wow!

Not having 50g programming experience it looks sophisticated to me. I'll look in the manual to find out how to feed it to my calc.

THANKS FOR THE EFFORT!!!

#8

OK.

I found the cable. I've got conn4X installed and the USB drivers loaded. I can do print screens to the PC. I've got your program in a text file.

What next please?



Possibly Related Threads…
Thread Author Replies Views Last Post
  Slightly OT: Remember the extraction of the HP-35 ROM? Frank Boehm (Germany) 1 1,188 02-06-2013, 05:53 PM
Last Post: aurelio
  Old Datamath quirk: anyone remember? Glenn Shields 6 1,955 10-09-2011, 10:56 PM
Last Post: David Ramsey
  HP97 box restore project (you may remember) Alberto Fenini 5 1,742 04-09-2010, 03:38 PM
Last Post: Alberto Fenini
  Hawkeye Bendix: Remember this one ? (2/?) [Long + pictures, Sorry] Etienne Victoria 4 1,428 03-22-2010, 10:20 PM
Last Post: tim m.
  Hawkeye: Remember this one? (1/?) Etienne Victoria 1 969 07-19-2009, 01:22 PM
Last Post: Katie Wasserman
  How to remember all the equations/programs? ravwalia 2 1,048 02-11-2008, 07:50 PM
Last Post: Chuck
  Re: I cant remember how I did it on the 50g Chuck Sommer 0 678 11-12-2007, 02:59 PM
Last Post: Chuck Sommer
  I think zero also is a number to remember... Arne Halvorsen (Norway) 1 822 09-29-2007, 05:12 PM
Last Post: Ed Look
  Thomas Radtke, where are you? Remember this? Prophetic!! Ed Look 9 2,354 08-10-2007, 05:15 PM
Last Post: Vincze
  Remember When.... Chuck 18 4,067 06-16-2007, 12:53 PM
Last Post: Chuck

Forum Jump: