algorithm to convert N into base 3 wanted!
Chuck_M_Grandgent at cup.portal.com
Chuck_M_Grandgent at cup.portal.com
Sun Aug 28 07:58:26 AEST 1988
tedj at hpcilzb.HP.COM (Ted Johnson) wants to know
> Does anyone know of an algorithm to convert a positive integer N into
> its base 3 representation? (e.g., 14 in base 10 is 112 in base 3).
> Any textbook/journal pointers are appreciated! (Source code is
> appreciated even more :-)
You may wish to look into a FORTH system, or its code.
FORTH has a system variable called BASE, and by storing the
desired base into BASE, all terminal I/O (numbers) are carried
out in the requested base.
For example 17 BASE ! (storing 17 into BASE)
will cause all subsequent terminal I/O, plus the arithmetic
operators to do their stuff in base 17. Source is available
for many FORTH systems.
============ sun!portal!cup.portal.com!chuck_m_grandgent===========
============ AEG Modicon, Industrial Automation Systems Group =====
More information about the Comp.lang.c
mailing list