The creall
function is part of the <tgmath.h>
header file in C.
It is used to return the real part of a complex number of type long double
. The function takes in a single parameter: a long double complex
number.
A complex number has a real and an imaginary part.
The illustration below shows how creall
works:
The creall
function is defined as follows:
long double creall(long double complex z);
It takes in a single parameter of type long double complex
.
The following code snippet shows how we can use the creall
function. The code below outputs the real part of the complex number:
#include <stdio.h> // Including header file for printf function #include <tgmath.h> // Including header file for creall function int main(){ long double complex z = 7.0 + 3.0*I; // assign value to variable printf("The real part is %Lf", creall(z)); return 0; }
creall
,creal
andcrealf
are similar functions.
creall
takes a long double
complex number and returns its long double
realcreal
takes a double
complex number and returns its double
realcrealf
takes a float
complex number and returns itsfloat
realRELATED TAGS
CONTRIBUTOR
View all Courses