Keil Logo

pow

Summary
#include <math.h>

double pow (
  double x,    /* value to use for base */
  double y);   /* value to use for exponent */
Description

The pow function calculates x raised to the yth power.

Return Value

The pow function returns the value xy.

  • If x != 0 and y = 0, pow returns a value of 1.
  • If x = 0 and y <= 0, pow returns NaN.
  • If x < 0 and y is not an integer, pow returns NaN.
See Also

sqrt

Example
#include <math.h>
#include <stdio.h> /* for printf */

void tst_pow (void) {
  float base;
  float power;
  float y;

  base = 2.0;
  power = 8.0;

  y = pow (base, power); /* y = 256 */

  printf ("%f ^ %f = %f\n", base, power, y);
}
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.