Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 alpha 4/15/85; site amd.UUCP Path: utzoo!watmath!clyde!amd!jimb From: jimb@amd.UUCP (Jim Budler) Newsgroups: net.micro.mac Subject: Re: Harmonic Series Benchmark Message-ID: <1363@amd.UUCP> Date: Sun, 26-May-85 20:28:48 EDT Article-I.D.: amd.1363 Posted: Sun May 26 20:28:48 1985 Date-Received: Mon, 27-May-85 00:43:58 EDT References: <> <> Reply-To: jimb@amd.UUCP (Jim Budler) Organization: AMD MOSCAD Lines: 61 In article <> jimb@amd.UUCP (Jim Budler) writes: >In article <> jimb@amd.UUCP (Jim Budler) writes: >>Someone on arpanet proposed a floating point benchmark of timing the >>sum of the first 10,000 terms of the harmonic series, i.e. for >>i = 1 to 100000; sum = sum + 1/i; >> >>He also stated the right answer was 9.787613 determined from a Vax 11/780 >>taking 0.02 seconds. >> >>Now either I'm doing it wrong or something > >Well, I now know the answer to my own question. I went back and took another closer look at the problem. The poster of the problem specified 32 bits for the problem. I redid my program, using both floats(32 bit), doubles(64 bit), and extended (80 bit). In addition I reread Bill Duval's words on the floating point and eliminated the casts from the program. i.e. was: j += ( 1.0 / (float) i ) where i is long. is: j += ( 1.0 / i) This resulted in a savings of about 5 seconds on the double, and 3 seconds on the float. Here are my final results. I'll post the source in net.sources.mac. Actual output of the program. ------------------------------------------------------------------- Calculating the sum of 10,000 terms of the harmonic series Vax 11/780 with FPU took 0.02 seconds the answer was 9.787613 This result from originator of problem. Assumed "right" answer. This is a Macintosh with Consulair Mac C 2.0, using float, 32 bit precision: Time = 29.43 Seconds Sum = 9.787613 Using Doubles: IBM3081 with UST System III took 0.00? seconds, the answer was 9.787606. A Valid 68000 CAD workstation 4.1c BSD took 23 seconds, the answer was 9.787606. This is a Macintosh with Consulair Mac C 2.0, using double, 64 bit precision: Time = 29.87 Seconds Sum = 9.787606 Bill Duvall of Consulair recommends using extended, 80 bit precision for computation with Mac C as that is the base mode of his implemntation of the SANE/IEEE numerics. This is a Macintosh with Consulair Mac C 2.0, using extended, 80 bit precision: Time = 25.15 Seconds Sum = 9.787606 -- Jim Budler Advanced Micro Devices, Inc. (408) 749-5806 UUCPnet: {ucbvax,decwrl,ihnp4,allegra,intelca}!amdcad!jimb Compuserve: 72415,1200