repo.or.cz
/
jruby.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Fix for JRUBY-2882. Handle error messages related to constructors better
[jruby.git]
/
bench
/
shootout
/
harmonic.ruby-2.ruby
blob
97f7b06ad72e276779c3602fddc5355efcf839f0
1
#!/usr/bin/ruby
2
# http://shootout.alioth.debian.org/
3
#
4
# Contributed by Christopher Williams
5
# modified by Daniel South
6
# modified by Doug King
7
8
n
= (
ARGV
[
0
] ||
10000000
).
to_i
9
10
partialSum
=
0.0
11
for
i
in
(
1
..
n
)
12
partialSum
+= (
1.0
/
i
)
13
end
14
15
printf
(
"%.9f
\n
"
,
partialSum
)