**Double:** The result of Math.pow is a double. We can cast this to an int if we know that no data loss due to narrowing will occur.

**Argument 1:** This is the base number we want to raise to a power. So to find the square of 5 we use 5 as the first argument to Math.pow.

**Argument 2:** This is the exponent. This can be fractional, but it is usually an int like 2 (which means square).

**Tip:** It may be easier to call square() than use Math.pow with specific arguments. The performance cost here is minimal or none.

© 2007-2020 Sam Allen. Every person is special and unique. Send bug reports to info@dotnetperls.com.

Home

Dot Net Perls