All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
3DoubleFuncTest.cpp
Go to the documentation of this file.
1 // ============================================================================
2 // Include files
3 // ============================================================================
4 // STD & STL
5 // ============================================================================
6 #include <math.h>
7 #include <stdio.h>
8 // ============================================================================
9 // GaudiMath
10 // ============================================================================
11 #include "GaudiMath/GaudiMath.h"
12 #include "GaudiMath/Adapters.h"
13 // ============================================================================
14 
15 // ============================================================================
23 // ============================================================================
24 
25 double sum ( double x, double y, double z )
26 {
27  return 3 * x * x - 5 * y * y + 3 * z * z;
28 }
29 
30 int main()
31 {
33  Genfun::Argument arg(3);
34 
35  std::string format( "x=%6.5f y=%6.5f z=%6.5f mysum=%+.10f");
36  format +=" sum=%+.10f sum-mysum=%+.10f \n" ;
37 
38  for ( double x = 0; x < 3; ++x)
39  {
40  for (double y = 0; y < 3; ++y)
41  {
42  for (double z = 0; z < 3; ++z)
43  {
44  arg[0] = x;
45  arg[1] = y;
46  arg[2] = z;
47  printf ( format.c_str() ,
48  x, y, z, mysum(arg), sum(x, y, z),
49  sum(x, y, z) - mysum(arg) );
50  }
51  }
52  }
53 
54  exit(0);
55 
56 }
57 
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
double sum(double x, double y, double z)
Genfun::AbsFunction Function
Definition: GaudiMath.h:24
STL class.
int main()
GAUDI_API AIDAFunction adapter(const AIDA::IFunction &function)
Definition: Adapters.cpp:27
T c_str(T...args)