CARM User's Guide

Discontinued

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);
}