[Shootout-list] harmonic sum for ghc and perl

Greg Buchholz sleepingsquirrel@member.fsf.org
Wed, 2 Mar 2005 09:23:45 -0800 (PST)


--0-891913794-1109784225=:27827
Content-Type: text/plain; charset=us-ascii
Content-Id: 
Content-Disposition: inline

    Attached are implementations of the harmonic sum benchmark for GHC
and Perl.  The benchmark description should probably mention that the
results should be rounded to 9 decimal places.

Greg Buchholz


	
		
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/
--0-891913794-1109784225=:27827
Content-Type: application/octet-stream; name="harmonic.ghc"
Content-Transfer-Encoding: base64
Content-Description: harmonic.ghc
Content-Disposition: attachment; filename="harmonic.ghc"

LS0gVGhlIEdyZWF0IENvbXB1dGVyIExhbmd1YWdlIFNob290b3V0Ci0tIGh0
dHA6Ly9zaG9vdG91dC5hbGlvdGguZGViaWFuLm9yZy8KLS0gc3VtIGhhcm1v
bmljIHNlcmllcwotLSBjb21pcGxlIHdpdGg6ICBnaGMgLU8yIC1vIGhhcm1v
bmljIGhhcm1vbmljLmhzCi0tIGNvbnRyaWJ1dGVkIGJ5IEdyZWcgQnVjaGhv
bHoKCmltcG9ydCBTeXN0ZW0oZ2V0QXJncykKaW1wb3J0IE51bWVyaWMKCm1h
aW4gPSBkbyBbbl0gPC0gZ2V0QXJncwogICAgICAgICAgcHV0U3RyTG4gJAog
ICAgICAgICAgICAgc2hvd0ZGbG9hdCAoSnVzdCA5KSAoZm9sZGwgKFx4IHkg
LT4gMS95K3gpIDAgWzEuLihyZWFkIG4pXSkgIiIK

--0-891913794-1109784225=:27827
Content-Type: text/x-perl; name="harmonic.perl"
Content-Description: harmonic.perl
Content-Disposition: inline; filename="harmonic.perl"

#!/usr/bin/perl -w
# The Great Computer Language Shootout
# http://shootout.alioth.debian.org/
# contributed by Greg Buchholz

$sum += 1/$_ for 1..$ARGV[0];
printf "%.9f\n", $sum;

--0-891913794-1109784225=:27827--