This documentation is archived and is not being maintained.

Complex.Abs Method

Gets the absolute value (or magnitude) of a complex number.

Namespace:  System.Numerics
Assembly:  System.Numerics (in System.Numerics.dll)

static member Abs : 
        value:Complex -> float 

Parameters

value
Type: System.Numerics.Complex
A complex number.

Return Value

Type: System.Double
The absolute value of value.

The absolute value of a complex number is equivalent to its Magnitude property. The absolute value of a real number a + bi is calculated as follows:

  • If b = 0, the result is 0.

  • If a > b, the result is a * Math.Sqrt(1 + b2/a2).

  • If b > a, the result is b * Math.Sqrt(1 + a2/b2).

If the calculation of the absolute value results in an overflow, the method returns either Double.PositiveInfinity or Double.NegativeInfinity. If either the Real or Imaginary property is Double.NaN and the other property is neither Double.PositiveInfinity nor Double.NegativeInfinity, the method returns Double.NaN.

The following example calculates the absolute value of a complex number and demonstrates that it is equivalent to the value of the Magnitude property.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: