Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-spam!ames!amdahl!amdcad!tim From: tim@amdcad.UUCP Newsgroups: comp.lang.c,comp.sys.m68k Subject: Ackermann's function is wrong in Moto Benchmark Report Message-ID: <16731@amdcad.AMD.COM> Date: Wed, 20-May-87 13:11:34 EDT Article-I.D.: amdcad.16731 Posted: Wed May 20 13:11:34 1987 Date-Received: Fri, 22-May-87 01:05:10 EDT Organization: Advanced Micro Devices, Inc., Sunnyvale, Ca. Lines: 34 Xref: utgpu comp.lang.c:2120 comp.sys.m68k:459 In the "Apples to Oranges" MC68020 Benchmark Report Motorola put out in 1986, the C code for Ackermann's function was shown as: /* Ackerman's function (in C) */ main() { A(3,6); } A(x,y) int x,y; { if (x==0) return (++y); if (y==0) return (A(--x,1)); return (A(--x,A(x,--y))); } The last line is incorrect. Depending upon evaluation order, the inner call to the A() function could use the undecremented value for x (correct) or the decremented value of x (incorrect). The last line should be written: return (A(x-1,A(x,--y))); Could someone from Motorola verify that the time to run the correct version of the benchmark is the same as the time listed for the incorrect version? -- Tim Olson Advanced Micro Devices