Export (0) Print
Expand All

Math::Pow Method

Updated: August 2009

Returns a specified number raised to the specified power.

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

public:
static double Pow(
	double x, 
	double y
)

Parameters

x
Type: System::Double

A double-precision floating-point number to be raised to a power.

y
Type: System::Double

A double-precision floating-point number that specifies a power.

Return Value

Type: System::Double
The number x raised to the power y.

The following table indicates the return value when various values or ranges of values are specified for the x and y parameters. For more information, see Double::PositiveInfinity, Double::NegativeInfinity, and Double::NaN.

Parameters

Return value

x or y = NaN.

NaN

x = Any value except NaN; y = 0.

1

x = NegativeInfinity; y < 0.

0

x = NegativeInfinity; y is a positive odd integer.

NegativeInfinity

x = NegativeInfinity; y is positive but not an odd integer.

PositiveInfinity

x < 0 but not NegativeInfinity; y is not an integer, NegativeInfinity, or PositiveInfinity.

NaN

x = -1; y = NegativeInfinity or PositiveInfinity.

NaN

-1 < x < 1; y = NegativeInfinity.

PositiveInfinity

-1 < x < 1; y = PositiveInfinity.

0

x < -1 or x > 1; y = NegativeInfinity.

0

x < -1 or x > 1; y = PositiveInfinity.

PositiveInfinity

x = 0; y < 0.

PositiveInfinity

x = 0; y > 0.

0

x = 1; y is any value except NaN.

1

x = PositiveInfinity; y < 0.

0

x = PositiveInfinity; y > 0.

PositiveInfinity

The following example uses the Pow method to calculate the value that results from raising 2 to a power ranging from 0 to 32.

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

XNA Framework

Supported in: 3.0, 2.0, 1.0

Date

History

Reason

August 2009

Replaced the example.

Customer feedback.

Community Additions

ADD
Show:
© 2014 Microsoft