Skip to content

Commit 5064c8c

Browse files
author
monkstone
committed
correct to_s
1 parent 2500b8b commit 5064c8c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

samples/contributed/mandelbrot.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ def add(c)
6666
@imag += c.imag
6767
end
6868

69-
# computes the magnitude
69+
# computes the magnitude (HelperMethods dist is a safer version of Math.hypot)
7070
def abs
71-
hypot(real, imag)
71+
dist(real, imag)
7272
end
7373

7474
def to_s
75-
format('(%d+%di)', real, imag)
75+
format('(%f+%fi)', real, imag)
7676
end
7777
end

0 commit comments

Comments
 (0)