Path: utzoo!utgpu!water!watmath!clyde!att!alberta!ubc-cs!uw-beaver!tektronix!uunet!portal!cup.portal.com!Chuck_M_Grandgent From: Chuck_M_Grandgent@cup.portal.com Newsgroups: comp.lang.c Subject: Re: algorithm to convert N into base 3 wanted! Message-ID: <8496@cup.portal.com> Date: 27 Aug 88 21:58:26 GMT References: <650003@hpcilzb.HP.COM> Organization: The Portal System (TM) Lines: 18 XPortal-User-Id: 1.1001.3636 tedj@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 =====