Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

cabs - Absolutbetrag einer komplexen Zahl

&pagelevel(4)&pagelevel

Definition

#include <math.h>

double cabs(__complex z);

cabs berechnet den Absolutbetrag einer komplexen Zahl z mit Realteil x und Imaginärteil y.

__complex ist ein in <math.h> vordefinierter Typ:

typedef struct{double x, y;} __complex

Returnwert

sqrt(z.x * z.x + z.y * z.y)

das ist der Absolutbetrag der komplexen Zahl z.

Bei Überlauf bricht das Programm ab (Signal SIGFPE)!

Beispiel

Folgendes Programm berechnet den Absolutbetrag einer komplexen Zahl.

#include <stdio.h>
#include <math.h>
int main(void)
{
 __complex z;
 if (scanf("%f %f", &z.x, &z.y) == 2)
     printf("%f : Absolutbetrag\n", cabs(z));
 return 0;
}

Siehe auch

abs, fabs, labs, llabs, sqrt