CppNoddy  0.92
All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Modules Pages
Namespaces | Functions
TrivialComplex.cpp File Reference

A sanity test for std::complex class. More...

#include <Types.h>

Go to the source code of this file.

Namespaces

namespace  CppNoddy
 A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechanics.
 
namespace  CppNoddy::Example
 

Functions

D_complex CppNoddy::Example::Cfn (const D_complex &z)
 A std::complex function for z^3 - 1. More...
 
int main ()
 

Detailed Description

A sanity test for std::complex class.

Definition in file TrivialComplex.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 23 of file TrivialComplex.cpp.

24{
25
26 cout << "\n";
27 cout << "=== Complex: simple test ============================\n";
28 cout << "\n";
29
30 D_complex Z( 0.0, 0.0 );
31 Z = Example::Cfn( D_complex( 0.5, 0.5 ) );
32
33 const double tol = 1.e-14;
34 const D_complex answer( -1.25, 0.25 );
35 if ( abs( Z - answer ) > tol )
36 {
37 cout << "\033[1;31;48m * FAILED \033[0m\n";
38 }
39 else
40 {
41 cout << "\033[1;32;48m * PASSED \033[0m\n";
42 }
43}
std::complex< double > D_complex
A complex double precision number using std::complex.
Definition: Types.h:98

© 2012

R.E. Hewitt