Newsgroups: comp.ai.genetic
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!godot.cc.duq.edu!newsgate.duke.edu!news.mathworks.com!newsfeed.internetmci.com!swrinde!sdd.hp.com!col.hp.com!news.dtc.hp.com!hplntx!hplb!jco
From: jco@hplb.hpl.hp.com (Joao Oliveira)
Subject: Re: What is the algorithm for Decimal to Binary Conversion?
Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
Message-ID: <DrvCA1.3MI@hplb.hpl.hp.com>
Date: Thu, 23 May 1996 17:22:48 GMT
References: <babbitt-0505960832200001@dal10-22.ppp.iadfw.net> <31A0FCEE.5C4B@cs.msu.su> <DrrpI4.DsM@hplb.hpl.hp.com> <klcrW6y00h4v4Q4o8M@andrew.cmu.edu>
Nntp-Posting-Host: incl05.hpl.hp.com
Organization: Hewlett-Packard Laboratories, Bristol, England
X-Newsreader: TIN [version 1.2 PL0.7]
Lines: 26

Richard Romero (rickr+@CMU.EDU) wrote:
: >main(){for(int x=24690;x/=2;)cout<<"01"[x%2];}
: >  
: >These are the smaller I can think of. I didn't include the #include <stream.h>
: >because you didn't include the <stdlib.h> one? The trick with the "01" was
: >pretty nifty.
: >  

: This one doesn't work--it skips the first digit.

	No it does not. I just posted this 'wrong' version for fun as in
the first mail what was asked was the binary value of 12345.

: Here's one that prints out in the right order, and should compile into a
: smaller set of machine instructions. (forget about the length of the C
: code--it's machine instructions that really matters :-)

	I thought the objective was to write the smaller program. I leave
assembler expertise to compilers (optimizers) :-)

joao
--
+ Joao Barreto Fernandes - Intelligent Networked Computing Lab  R&D placement +
+ Hewlett Packard Labs, Filton Rd, Bristol BS12 6QZ England   +44 117 9228714 +
+ jco@hplb.hpl.hp.com   http://www-incl/~jco  http://www.di.fc.ul.pt/~barreto +
+       'All points of view are my own and not necessarily HP's as well'      +
