Rate This Document
Findability
Accuracy
Completeness
Readability

cdiv

Perform division operations on complex numbers.

Interface Definition

C interface:

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

double complex cdiv(double complex x);

double complex cdiv_18(double complex x);

cdiv_18 is provided only in the high-precision version.

Parameters

Parameter

Type

Description

Input/Output

x

  • For cdivf, x is of complex single-precision floating-point type.
  • For cdiv and cdiv_18, x is of complex double-precision floating-point type.

Floating-point value of the input data.

Input

y

  • For cdivf, y is of complex single-precision floating-point type.
  • For cdiv and cdiv_18, y is of complex double-precision floating-point type.

Floating-point value of the input data.

Input

Return Value

The result of complex number division is returned.

Dependency

C: "km.h"

Example

C interface:
    double x1 = 1.0, x2 = 1.0, x3 = 1.0, x4 = 1.0;
    double complex cx1;
    double complex cx2;
    // print result
    double ry;
    double iy;
    cx1 = __builtin_complex(x1, x2);
    cx2 = __builtin_complex(x3, x4);
    ry = __real__ cdiv(cx1, cx2);
    iy = __imag__ cdiv(cx1, cx2);
    printf("cdiv(cx1, cx2) = %.15f, %.15f\n", ry, iy);

   /*
    * cdiv(cx1, cx2) = 1.000000000000000, 0.000000000000000
    */