Rate This Document
Findability
Accuracy
Completeness
Readability

cpow

Act as the pow interface for complex numbers.

Interface Definition

C interface:

float complex cpowf(float complex x, float complex y);

double complex cpow(double complex x, double complex y);

long double complex cpowl(long double complex x, long double complex y);

Fortran interface:

RES = POWF(X, Y);

RES = POW(X, Y);

Parameters

Parameter

Type

Description

Input/Output

x

  • For cpowf, x is of complex single-precision floating-point type.
  • For cpow, x is of complex double-precision floating-point type.
  • For cpowl, x is of complex, long, double-precision floating-point type.

Floating-point value of the input data.

Input

y

  • For cpowf, y is of complex single-precision floating-point type.
  • For cpow, y is of complex double-precision floating-point type.
  • For cpowl, y is of complex, long, double-precision floating-point type.

Floating-point value of the input data.

Input

Return Value

For the special values, see cpow.xlsx.

Dependency

C: "km.h"

Examples

C interface:

    double x1 = 1.0, x2 = 2.0, x3 = 3.0, x4 = 4.0;
    double complex cx1 = __builtin_complex(x1, x2);
    double complex cx2 = __builtin_complex(x3, x4);

    // print result
    double ry;
    double iy;
    ry = __real__ cpow(cx1, cx2);
    iy = __imag__ cpow(cx1, cx2);
    printf("cpow(cx1, cx2) = %.15f, %.15f\n", ry, iy);
    /*
     * cpow(cx1, cx2) = 0.129009594074467, 0.033924092905170 
     * */
Fortran interface:
    REAL(8) :: X = 3.0 
    REAL(8) :: Y = -3.0 
    PRINT*,  POW(X, Y) 
    ! 
    ! OUTPUT 
    !     0.037037037037037
    !