Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
|
|
@ -1,9 +1,10 @@
|
|||
require 'complex' # With Ruby 1.9, this line is optional.
|
||||
|
||||
# Two ways to write complex numbers:
|
||||
# Three ways to write complex numbers:
|
||||
a = Complex(1, 1) # 1. call Kernel#Complex
|
||||
i = Complex::I # 2. use Complex::I
|
||||
b = 3.14159 + 1.25 * i
|
||||
c = '1/2+3/4i'.to_c # 3. Use the .to_c method from String, result ((1/2)+(3/4)*i)
|
||||
|
||||
# Operations:
|
||||
puts a + b # addition
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue