Skip to content
instance method

Complex#abs2

() -> ::Numeric
abs2 → float

Returns square of the absolute value (magnitude) for self; see polar coordinates:

Example
Complex.polar(2, 2).abs2 # => 4.0

If self was created with rectangular coordinates, the returned value is computed, and may be inexact:

Example
Complex.rectangular(1.0/3, 1.0/3).abs2 # => 0.2222222222222222
See also #abs #angle #== #arg also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0