Ruby 1.9.2 Reference Manual > All Libraries > library complex > class Numeric > im

instance method Numeric#im

im -> Complex [added by complex]

実数に対し、純虚数化した Complex クラスのオブジェクトを返します。

例:

require "complex"
n = 100
n.im   #=> (0+100i)