repo.or.cz
/
ruby-svn.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
add a test for [ruby-dev:34579].
[ruby-svn.git]
/
benchmark
/
bm_app_mandelbrot.rb
blob
a0dcf5e874aff7c92c90368bfb710631e37d7033
1
require 'complex'
2
3
def mandelbrot? z
4
i = 0
5
while i<100
6
i+=1
7
z = z * z
8
return false if z.abs > 2
9
end
10
true
11
end
12
13
ary = []
14
15
(0..100).each{|dx|
16
(0..100).each{|dy|
17
x = dx / 50.0
18
y = dy / 50.0
19
c = Complex(x, y)
20
ary << c if mandelbrot?(c)
21
}
22
}
23