#include #include "StatTools/Funct/Fraction.h" #include "StatTools/Funct/Operators.h" #include "StatTools/Funct/SimplifyNumerical.h" #include "StatTools/Funct/NumericalIO.h" using namespace Funct; using namespace std; int main() { // test basic numerical constant // Numerical< 0 > _0; // Numerical< 1 > _1; Numerical< 2 > _2; Numerical< 3 > _3; Numerical< 4 > _4; Numerical< 6 > _6; // Numerical< -1 > m1; Numerical< -2 > m2; Numerical< -4 > m4; cout << _2 << " + " << _3 << " = " << _2 + _3 << endl; cout << _2 << " * " << _3 << " = " << _2 * _3 << endl; cout << _2 << " - " << _3 << " = " << _2 - _3 << endl; cout << _2 << " / " << _3 << " = " << _2 / _3 << endl; cout << _6 << " / " << _4 << " = " << _6 / _4 << endl; cout << _4 << " / " << _2 << " = " << _4 / _2 << endl; cout << _4 << " / " << m2 << " = " << _4 / m2 << endl; cout << m4 << " / " << _2 << " = " << m4 / _2 << endl; cout << m4 << " / " << m2 << " = " << m4 / m2 << endl; Fraction< 3, 4 >::type _3_4; Fraction< 4, 2 >::type _4_2; cout << "3/4 => " << _3_4 << endl; cout << "4/2 => " << _4_2 << endl; cout << "- 3/4 => " << - _3_4 << endl; cout << _2 / _3 << " + " << _3 / _4 << " = " << _2 / _3 + _3 / _4 << endl; cout << _2 / _3 << " - " << _3 / _4 << " = " << _2 / _3 - _3 / _4 << endl; cout << _2 / _3 << " * " << _3 / _4 << " = " << ( _2 / _3 ) * ( _3 / _4 ) << endl; cout << _2 / _3 << " / " << _3 / _4 << " = " << ( _2 / _3 ) / ( _3 / _4 ) << endl; cout << _2 << " + " << _3 / _4 << " = " << _2 + _3 / _4 << endl; cout << _2 << " - " << _3 / _4 << " = " << _2 - _3 / _4 << endl; cout << _2 / _3 << " + " << _3 << " = " << _2 / _3 + _3 << endl; cout << _2 / _3 << " - " << _3 << " = " << _2 / _3 - _3 << endl; cout << _2 / _3 << " * " << _3 << " = " << ( _2 / _3 ) * _3 << endl; cout << _2 / _3 << " / " << _3 << " = " << ( _2 / _3 ) / _3 << endl; return 0; }