to_i

cmp.to_i â integer
Instance Public methods

Returns the value as an integer if possible (the imaginary part should be exactly zero).

Complex(1, 0).to_i    #=> 1
Complex(1, 0.0).to_i  # RangeError
Complex(1, 2).to_i    # RangeError
doc_ruby_on_rails
2015-04-01 15:22:47
Comments
Leave a Comment

Please login to continue.