From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a96b706fab1e8c2c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-30 10:32:49 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!news.maxwell.syr.edu!newsfeed.skycache.com!Cidera!news-reader.ntrnet.net!uunet!ash.uu.net!dca.uu.net!news5-gui.server.ntli.net!ntli.net!news2-win.server.ntlworld.com.POSTED!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada References: <9e2x6.568987$JT5.15730002@news20.bellglobal.com> <9a2dnu$sff$1@nh.pace.co.uk> Subject: Re: Binary value X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Fri, 30 Mar 2001 19:21:42 +0100 NNTP-Posting-Host: 62.252.149.66 X-Complaints-To: abuse@ntlworld.com X-Trace: news2-win.server.ntlworld.com 985976490 62.252.149.66 (Fri, 30 Mar 2001 19:21:30 BST) NNTP-Posting-Date: Fri, 30 Mar 2001 19:21:30 BST Organization: ntlworld News Service Xref: supernews.google.com comp.lang.ada:6265 Date: 2001-03-30T19:21:42+01:00 List-Id: > I see... that answers half of my question. This presumes I wanna convert > from binary to Integer. But is it possible to "convert" a Integer value to > binary. Suppose you have the value 123 in binary. To convert to binary you need to follow this algorithm. while num /= 0 loop rem := num mod 2; -- get remainder num := num - rem; add rem'image to front* of string; end loop; {I think this is the correct algorithm!} You could do it recursively too. Hope this helps, Chris Campbell *if you add rem'image onto the end you'll have to reverse the string after you finish so it'd be better to add it to the front. I'm assuming you'll use an unbounded string in the loop and will convert it to a string outside if you wish.