real
raw OCR
Returns the real part of a complex number or converts a BCD number back to float, double or long double.
Defined in header <complex.h>
Syntax
As defined in complex: As defined in bed:
#include <complex.h> #include <bcd.h>
double reaKcomplex x); double real(bcd x);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ | ■ |
Remarks
The data associated to a complex number consists of two floating-point numbers, real returns the one considered to be the real part.
You can also use real to convert a binary coded decimal number back to a float, double, or long double.
Return value
The real part of part of the complex number.
See also
Example
#include <complex.h>
int main(void)
{
double X = 3.1, y = 4.2;
complex z = complex(x,y);
cout « "z = " « z « "\n";
cout « " has real part = " « real(z) « "\n";
cout << " and imaginary real part = " « imag(z) << "\n";
cout << "z has complex conjugate = " « con](z) << "\n";
return 0;
#include <bcd.h>
#include <iostream.h>
int main(void)
{
bed X = 3.1;
cout << "The bed number x = " << x << "\n";
eout << "Its binary equivalent is " << real(x) << "\n";
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/complex.h/real/
· short form /3.1/real/