Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HP48/49 mini base converter

95 views
Skip to first unread message

John H Meyers

unread,
May 3, 2001, 10:18:08 PM5/3/01
to
Yet another style of converter:

This quickly converts integers from any base to decimal,
and from decimal to any base;
by switching bases between these operations,
you can convert from any base to any other base.

Since all values are stored in "real number" objects,
no more than 12 digits can be stored.

For bases 11 through 100, two decimal digits must be used
to represent one "base digit" (e.g. #F5h is represented as 1505),
so only six "digits" are available for values in these bases
(note that "base 100" is exactly the same as decimal :)

Bases 101 - 1000 require three decimal digits per "base digit," etc.

If any conversion "overflows" the number of digits available,
only the rightmost result digits are calculated
(but see note below about "IDIV vs. IP" in such cases).

Press SetB to set each new integer base;
no default base is initially provided
(so it retains previous settings if restarted,
provided that you did not press 'Exit')


%%HP: T(3)F(.); @ Include this line for Kermit download only

\<< {
{ "B\->D" \<< \-> R '\GS(N=0.,11.,(IP(R/(M^N)) MOD M)*B^N)' \>> }
{ "D\->B" \<< \-> D '\GS(N=0.,11.,(IP(D/(B^N)) MOD B)*M^N)' \>> }
{ "SetB" \<< 0. RND DUP 'B' STO LOG CEIL ALOG 'M' STO \>> }
{ } { } { "Exit" \<< { B M } PURGE 0. MENU \>> }
} TMENU STD \>> 'MBCV' STO

@ End of downloadable file


This is actually derived from a "solve" menu in my HP17BII,
which does the same thing:

IF( NOT S(M) : IF( S(R) :
R-Sigma(N:0:11:1:MOD(IDIV(D:B^N):B)*M^N) :
D-Sigma(N:0:11:1:MOD(IDIV(R:M^N):M)*B^N)
) : M-ALOG(-INT(-LOG(B))) )

Note that the HP48/49 does not have an IDIV function
(true integer quotient -- truncated, not rounded),
so I substituted IP, which is actually not equivalent;
e.g. IDIV(2E12:3) should be 666666666666 not 666666666667.

I should have thought of suggesting that IDIV be added to HP49,
but I'd already suggested it for the HP48 some years before,
and I thought that one suggestion was enough :)

-----------------------------------------------------------
With best wishes from: John H Meyers <jhme...@mum.edu>

Steen S. Schmidt

unread,
May 4, 2001, 2:51:42 AM5/4/01
to
> I should have thought of suggesting that IDIV be added to HP49

Look at IDIV2.

Regards
Steen


John H Meyers

unread,
May 4, 2001, 1:34:34 PM5/4/01
to Steen S. Schmidt
jhm> I should have thought of suggesting that IDIV be added to HP49

sss> Look at IDIV2.

Thanks, but it won't quite fill the bill:

Like other CAS commands, it demands that you change modes, etc.,
which is not my idea of a user-friendly ordinary real-valued function
like IDIV, which has been in all the finer HP financial models
(HP18C, HP17B[II], HP19B[II]) for many years,
but got lost from the sci/math series.


Newsfeeds.com was down when the "mini base converter" was posted;
if the original article never appeared where you are, try here:

http://groups.google.com/groups?ic=1&selm=3AF54958%40MailAndNews.com

-----------------------------------------------------------
With best wishes from: John H Meyers <jhme...@mum.edu>


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----

Steen S. Schmidt

unread,
May 4, 2001, 3:00:27 PM5/4/01
to
> Thanks, but it won't quite fill the bill:
>
> Like other CAS commands, it demands that you change modes, etc.,

When does IDIV2 force you to change modes? It accepts both reals and
integers, and is happy with whatever mode you are in.

Regards
Steen


John H Meyers

unread,
May 4, 2001, 5:35:21 PM5/4/01
to Steen S. Schmidt
jhm:

> Like other CAS commands, IDIV2 demands that you change modes, etc.

Steen S. Schmidt:

> When does IDIV2 force you to change modes?
> It accepts both reals and integers,
> and is happy with whatever mode you are in.

IDIV2 is not even a function (can not be used in algebraic formulas),
and even the command (which returns the results of both IDIV and MOD)
does ask for mode changes, e.g.:

{ #7880010200605FF3h #0h #7555610A216020h #0h } STOF

2E12 3. IDIV2

Message boxes:

"Const -> value mode off?"

"Radian mode on?"

So, IDIV2 is not a function, can not be used transparently,
and is therefore not really a replacement for IDIV;
finally, it still isn't in the HP48, either :)

( a version of IDIV for real args )
:: CK2&Dispatch REALREAL
:: 2%>%% %%/ DUP %%ABS %%FLOOR 2%%>% SWAP %SGN %* ; ;

0 new messages