#!/usr/bin/ruby
#
## https://rosettacode.org/wiki/Roots_of_unity#Sidef
#
func roots_of_unity (n) {
n.of { |j|
exp(2.i * Complex.pi / n * (j-1))
}
}
roots_of_unity(5).each { |c|
printf("%+.5f%+.5fi\n", c.reals);
}
#!/usr/bin/ruby
#
## https://rosettacode.org/wiki/Roots_of_unity#Sidef
#
func roots_of_unity (n) {
n.of { |j|
exp(2.i * Complex.pi / n * (j-1))
}
}
roots_of_unity(5).each { |c|
printf("%+.5f%+.5fi\n", c.reals);
}