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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, LOTS_OF_MONEY autolearn=no 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 09:12:06 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!isdnet!psinet-france!psiuk-f4!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Binary value Date: Fri, 30 Mar 2001 11:54:21 -0500 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <9a2dnu$sff$1@nh.pace.co.uk> References: <9e2x6.568987$JT5.15730002@news20.bellglobal.com> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 985971262 29167 136.170.200.133 (30 Mar 2001 16:54:22 GMT) X-Complaints-To: newsmaster@pace.co.uk NNTP-Posting-Date: 30 Mar 2001 16:54:22 GMT 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 Xref: supernews.google.com comp.lang.ada:6256 Date: 2001-03-30T16:54:22+00:00 List-Id: It could not possibly get any easier. Ada allows you to express numeric literals in bases other than 10. The syntax is B#nnnn# where B is a base and the nnnn is the number in appropriate base representation. (octal, hex, binary,... base 7 or 5 if you want to be unique!) So a binary number could be expressed as: 2#1111_1111_1111_1111# or just for fun: 16#FFFF# 8#177777# 10#65535# IIRC, you can only use bases between 2..16 - but that covers most of the ground anybody would want. Note also that burried somewhere in Text_IO are routines that will allow you to print results using a base other than 10 - just in case you want to do a little I/O with your bits... MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Bob Gratton" wrote in message news:9e2x6.568987$JT5.15730002@news20.bellglobal.com... > Ok... now I know how to use bitwise operators... I'd like to know also how > to convert an integer value to its equivalent in binary. > > e.g.: 123 => 1111011 > > Thanx again! > > Bob > >