Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site oakhill.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!umcp-cs!gymble!lll-crg!dual!mordor!ut-sally!oakhill!davet From: davet@oakhill.UUCP (Dave Trissel) Newsgroups: net.arch,net.lang.c,net.micro,net.micro.pc,net.micro.68k Subject: Need 286 "C" benchmark Message-ID: <426@oakhill.UUCP> Date: Fri, 17-May-85 13:09:27 EDT Article-I.D.: oakhill.426 Posted: Fri May 17 13:09:27 1985 Date-Received: Sun, 19-May-85 06:34:34 EDT Organization: Motorola Inc. Austin, Tx Lines: 62 Xref: linus net.arch:1026 net.lang.c:4743 net.micro:9150 net.micro.pc:3697 net.micro.68k:725 Computer Architecture Fans: Could you help us in an experiment? We need to run the following benchmark on 286 and 68k machines. If you have the Intel 310 sytem or the IBM PC/AT (or any other 286 system) we would greatly appreciate the results. The benchmark comes from a description in Doug Hoffsteder's "Godel, Escher, Bach". [Thanks to Charles River Data Systems for providing the "C" source.] Dave Trissel {ihnp4,seismo,gatech,ctvax}!ut-sally!oakhill!davet Motorola Semiconductor Inc. Austin, Texas ----------------------------------------------------------------------- Below is a source listing of a C program. The program takes each integer from 1 to 999 and checks to see if it is even or positive. If the number is even it divides it by 2, if it is odd the number is multiplied by 3 and then 1 is added. Then back to the even-odd test with the mentioned changes until the number is one. After that the next number in the 1 to 999 range is manipulated and so one. After this is completed the next part of the program does the same thing, except this time it keeps a histogram of all the values of the number. #include main() { register int i, k, j; register unsigned int max = 0; for (i=1; i < 1000; ++i) { k= i; while (k != 1) { if (max < k) max = k; j = k/2; j = j*2; if (j == k) k = k/2; else k = k*3 + 1; } } hst(max); } hst(max) register unsigned int max; { register int i, k, j; short *h = calloc(max+1,sizeof(short)); for (i=1; i < 1000; ++i) { k= i; while (k != 1) { ++(h[k]); j = k/2; j = j*2; if (j == k) k = k/2; else k = k*3+1; } } } -----------------------------------------------------------------------