/* 

 File: costlytest_ci.cpp, 2005/10/17

 Testing the CoStLy functions library
 Here: result type is CInterval, not Interval

 Usage: costlytest [function name] [output file] [date]

 CoStLy (COmplex interval STandard functions LibrarY), Version 2.0.4

 Copyright (C) Markus Neher, markus.neher@math.uni-karlsruhe.de
               Ingo Eble,    ingoeble@web.de

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#include "cimath.h"
#include <iostream>
#include <fstream>

using Adapt::PI;
using Adapt::HALFPI;

//-- pointer on CInterval function f -------------------------------- 050808 --
//
typedef CInterval (*f_pointer)(const CInterval&);
f_pointer my_f;

//-- global variables ----------------------------------------------- 050922 --
//
const double MAXREAL       = 1.7976931348623158E+308;
const double MINREAL       = 4.9406564584124654E-324;
const double ONE_PLUS_EPS  = 1.0000000000000002220446049250313;
const double ONE_MINUS_EPS = 0.9999999999999998889776975374843;
double prmin, prmax, pimin, pimax, nrmin, nrmax, nimin, nimax;
//
//-- end global variables -----------------------------------------------------

//-- res_write ------------------------------------------------------ 050808 --
//
//  regular output procedure
//
void res_write( const std::string& szn, 
                const CInterval& ci, const CInterval& ri )
{
  std::cout<<szn+"       = "<<ci<<std::endl;
  std::cout<<"f("+szn+")    = "<<ri<<std::endl;
  //
  //  harmonize output format of doubles with interval output format
  //
  char widthbufre [15],  widthbufim [15];
  sprintf( widthbufre, "%8.6E", sup(ri.re())-inf(ri.re()) );
  sprintf( widthbufim, "%8.6E", sup(ri.im())-inf(ri.im()) );
  std::string widthstrre = widthbufre;
  std::string widthstrim = widthbufim;
  //  width zero may be printed as "-0.000000E+00"
  //  remove leading "-"
  if( widthstrre.substr(0,1) == "-" )
    widthstrre = widthstrre.substr(1,15);
  if( widthstrim.substr(0,1) == "-" )
    widthstrim = widthstrim.substr(1,15);
  //  the exponent is sometimes displayed with only 2 digits
  //  insert leading zero
  if( widthstrre.length() == 12 )
    widthstrre = widthstrre.substr(0,10)+"0"+widthstrre.substr(10,2);
  if( widthstrim.length() == 12 )
    widthstrim = widthstrim.substr(0,10)+"0"+widthstrim.substr(10,2);
  //  a zero exponent is sometimes displayed as E-000
  //  replace "-" by "+"
  if( widthstrre.substr(8,5) == "E-000" )
    widthstrre = widthstrre.substr(0,8)+"E+000";
  if( widthstrim.substr(8,5) == "E-000" )
    widthstrim = widthstrim.substr(0,8)+"E+000";
  std::cout<<"w(f("+szn+")) =  ( "<<widthstrre<<", "<<widthstrim<<")"<<std::endl<<std::endl;
}
//
//-- end res_write ------------------------------------------------------------

//-- err_write ------------------------------------------------------ 050808 --
//
//  error output procedure
//
void err_write( const std::string& szn, const CInterval& ci )
{
  std::cout<<szn+"       = "<<ci<<std::endl;
  std::cout<<"Function domain error: f("+szn+") is not computable with CoStLy Version "+CoStLy::Version()<<std::endl<<std::endl<<std::endl;
}
//
//-- end err_write ------------------------------------------------------------

//-- domain check functions ----------------------------------------- 050808 --
//
bool posreals( const CInterval& z )
{
  Interval rez = z.re(), imz = z.im();

  if( inf(imz) > 0.0 or sup(imz) < 0.0 or inf(rez) > prmax or sup(rez) < prmin )
      return true;
  else
    return false;
}

bool posimags( const CInterval& z )
{
  Interval rez = z.re(), imz = z.im();

  if( inf(rez) > 0.0 or sup(rez) < 0.0 or inf(imz) > pimax or sup(imz) < pimin )
      return true;
  else
      return false;
}

bool negreals( const CInterval& z )
{
  Interval rez = z.re(), imz = z.im();

  if( inf(imz) > 0.0 or sup(imz) < 0.0 or inf(rez) > nrmax or sup(rez) < nrmin )
      return true;
  else
      return false;
}

bool negimags( const CInterval& z )
{
  Interval rez = z.re(), imz = z.im();

  if( inf(rez) > 0.0 or sup(rez) < 0.0 or inf(imz) > nimax or sup(imz) < nimin )
      return true;
  else
      return false;
}
//
//-- end domain check functions -----------------------------------------------

//-- my_f1 ---------------------------------------------------------- 050808 --
//
//  function call with axes intersection check
//
void my_f1( const std::string& szn, const CInterval z )
{
  if( posreals( z ) and posimags( z ) and negreals( z ) and negimags( z ) )
    {
      CInterval res = my_f( z );
      res_write( szn, z, res );
    }
  else
      err_write( szn, z );
}
//-- my_f8 ---------------------------------------------------------- 050808 --
//
//  compute 8 function values using rotations and reflections of z
//
void my_f8( const std::string& szn, const Interval x, const Interval y )
{
  CInterval z;

  //  basic interval in quadrant I
  z = CInterval(x,y);
  my_f1( szn+"a", z );

  //  reflection of "a" at x-axis into quadrant IV
  z = CInterval(x,-y);
  my_f1( szn+"b", z );

  //  rotation of "a" into quadrant II
  z = CInterval(-y,x);
  my_f1( szn+"c", z );

  //  reflection of "c" at y-axis into quadrant I
  z = CInterval(y,x);
  my_f1( szn+"d", z );

  //  rotation of "a" into quadrant III
  z = CInterval(-x,-y);
  my_f1( szn+"e", z );

  //  reflection of "e" at x-axis into quadrant II
  z = CInterval(-x,y);
  my_f1( szn+"f", z );

  //  rotation of "a" into quadrant IV
  z = CInterval(y,-x);
  my_f1( szn+"g", z );

  //  reflection of "g" at y-axis into quadrant III
  z = CInterval(-y,-x);
  my_f1( szn+"h", z );
}
//
//-- end my_f8 ----------------------------------------------------------------

int main(int argc, char* argv[])
{  
  //  compiler option: abort execution in case of overflow
  //  only available for C-XSC, not for filib++
#ifdef CXSC_VERSION
  feenableexcept(FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW);
#endif
  //
  //-- input section ----------------------------------------------------------
  //
  //  read function name and output file from input parameters
  //
  std::string f_date, f_name;
  std::filebuf f;
  std::streambuf* buf;

  if( argc > 4 )
    {
      std::cerr<<"Error: Too many input parameters!"<<std::endl;
      return 0;
    }
  if( argc > 3 )
    //  current date supplied as parameter
    f_date = argv[3];
  else
    //  no date specified: use default
    f_date = "[date]";
  if( argc > 2 )
    //  output file supplied as parameter: redirect output
    {     
      f.open(argv[2], std::ios::out);
      buf = std::cout.rdbuf();
      std::cout.rdbuf(&f);
    }
  if( argc > 1 )
    //  function name supplied as parameter
    f_name = argv[1];
  else
    //  no function name specified
    {
      std::cout<<"Please enter function name: ";
      std::cin>>f_name;
    }
  //
  //  check function name and  supply domain values
  //  general rule: the forbidden part of each half axis is given
  //  
  //  example for Atan:
  //  prmin = MAXREAL, prmax = -1:  entire positive real axis is in the domain
  //  pimin = 1.0, pimax = MAXREAL: i*[1,\infty) is not in the domain
  //  
  std::string 
    expetal = "_exp_cos_cosh_sin_sinh",
    tanetal = "_cot_coth_tan_tanh_ctn_tct";
  if( expetal.find( f_name ) < 22 or tanetal.find( f_name ) < 26 )
    //  these functions are either defined for all z \in C
    //  or singular points are treated in the respective function procedure
    {
      prmin = MAXREAL; prmax = -1.0;
      pimin = MAXREAL; pimax = -1.0;
      nrmin = 1.0; nrmax = -MAXREAL;
      nimin = 1.0; nimax = -MAXREAL;
      if( f_name == "exp" )
	my_f = CoStLy::exp;
      else if( f_name == "cos" )
	my_f = CoStLy::cos;
      else if( f_name == "cosh" )
	my_f = CoStLy::cosh;
      else if( f_name == "sin" )
	my_f = CoStLy::sin;
      else if( f_name == "sinh" )
	my_f = CoStLy::sinh;
      else if( f_name == "cot" )
	my_f = CoStLy::cot;
      else if( f_name == "ctn" )  //  cot via tan
	my_f = CoStLy::ctn;
      else if( f_name == "coth" )
	my_f = CoStLy::coth;
      else if( f_name == "tan" )
	my_f = CoStLy::tan;
      else if( f_name == "tct" )  //  tan via cot
	my_f = CoStLy::tct;
      else //  f_name == "tanh"
	my_f = CoStLy::tanh;
    }
  else if( f_name == "Acos" )
    {
      my_f = CoStLy::Acos;
      //  exlude parts of real axis from domain
      prmin = ONE_PLUS_EPS; prmax = MAXREAL;
      pimin = MAXREAL; pimax = -1.0;
      nrmin = -MAXREAL; nrmax = -ONE_PLUS_EPS;
      nimin = 1.0; nimax = -MAXREAL;
    }
  else if( f_name == "Acsn" )
    {
      my_f = CoStLy::Acsn;
      //  exlude parts of real axis from domain
      prmin = ONE_PLUS_EPS; prmax = MAXREAL;
      pimin = MAXREAL; pimax = -1.0;
      nrmin = -MAXREAL; nrmax = -ONE_PLUS_EPS;
      nimin = 1.0; nimax = -MAXREAL;
    }
  else if( f_name == "Acosh" )
    {
      my_f = CoStLy::Acosh;
      //  exlude part of real axis from domain
      prmin = 0.0; prmax = ONE_MINUS_EPS;
      pimin = MAXREAL; pimax = -1.0;
      nrmin = -MAXREAL; nrmax = 0.0;
      nimin = 1.0; nimax = -MAXREAL;
    }
  else if( f_name == "Acot" )
    {
      my_f = CoStLy::Acot;
      //  exlude parts of imaginary axis from domain
      prmin = 0.0; prmax = 0.0;
      pimin = 0.0; pimax = 1.0;
      nrmin = 0.0; nrmax = 0.0;
      nimin = -1.0; nimax = 0.0;
    }
  else if( f_name == "Acoth" )
    {
      my_f = CoStLy::Acoth;
      //  exlude parts of imaginary axis from domain
      prmin = 0.0; prmax = 1.0;
      pimin = 0.0; pimax = 0.0;
      nrmin = -1.0; nrmax = 0.0;
      nimin = 0.0; nimax = 0.0;
    }
  else if( f_name == "Asin" )
    {
      my_f = CoStLy::Asin;
      //  exlude parts of real axis from domain
      prmin = ONE_PLUS_EPS; prmax = MAXREAL;
      pimin = MAXREAL; pimax = -1.0;
      nrmin = -MAXREAL; nrmax = -ONE_PLUS_EPS;
      nimin = 1.0; nimax = -MAXREAL;
    }
  else if( f_name == "Ascs" )
    {
      my_f = CoStLy::Ascs;
      //  exlude parts of real axis from domain
      prmin = ONE_PLUS_EPS; prmax = MAXREAL;
      pimin = MAXREAL; pimax = -1.0;
      nrmin = -MAXREAL; nrmax = -ONE_PLUS_EPS;
      nimin = 1.0; nimax = -MAXREAL;
    }
  else if( f_name == "Asinh" )
    {
      my_f = CoStLy::Asinh;
      //  exlude parts of imaginary axis from domain
      prmin = MAXREAL; prmax = -1.0;
      pimin = ONE_PLUS_EPS; pimax = MAXREAL;
      nrmin = 1.0; nrmax = -MAXREAL;
      nimin = -MAXREAL; nimax = -ONE_PLUS_EPS;
    }
  else if( f_name == "Atan" )
    { 
      my_f = CoStLy::Atan;
      //  exlude parts of imaginary axis from domain
      prmin = MAXREAL; prmax = -1.0;
      pimin = 1.0; pimax = MAXREAL;
      nrmin = 1.0; nrmax = -MAXREAL;
      nimin = -MAXREAL; nimax = -1.0;
    }
  else if( f_name == "Atanh" )
    { 
      my_f = CoStLy::Atanh;
      //  exlude parts of imaginary axis from domain
      prmin = 1.0; prmax = MAXREAL;
      pimin = MAXREAL; pimax = -1.0;
      nrmin = -MAXREAL; nrmax = -1.0;
      nimin = 1.0; nimax = -MAXREAL;
    }
  else if( f_name == "Ln" )
    {
      f_name = "Ln ";
      my_f = CoStLy::Ln;
      //  exlude origin and negative real axis from domain
      prmin = 0.0; prmax = 0.0;
      pimin = 0.0; pimax = 0.0;
      nrmin = -MAXREAL; nrmax = 0.0;
      nimin = 0.0; nimax = 0.0;
    }
  else if( f_name == "ln" )
    {
      f_name = "ln ";
      my_f = CoStLy::ln;
      //  exlude origin from domain
      prmin = 0.0; prmax = 0.0;
      pimin = 0.0; pimax = 0.0;
      nrmin = 0.0; nrmax = 0.0;
      nimin = 0.0; nimax = 0.0;
    }
  else if( f_name == "sqr" )
    {
      my_f = CoStLy::sqr;
      //  domain restriction is handled below
      prmin = MAXREAL; prmax = -1.0;
      pimin = MAXREAL; pimax = -1.0;
      nrmin = 1.0; nrmax = -MAXREAL;
      nimin = 1.0; nimax = -MAXREAL;
    }
  else if( f_name == "Sqrt" )
    {
      my_f = CoStLy::Sqrt;
      //  exlude negative real axis from domain, but keep origin
      prmin = MAXREAL; prmax = -1.0;
      pimin = MAXREAL; pimax = -1.0;
      nrmin = -MAXREAL; nrmax = -MINREAL;
      nimin = 1.0; nimax = -MAXREAL;
    }
  else 
    {
      std::cout<<"Unknown function : "<<f_name<<std::endl;
      return 0;
    }
  //
  //-- prep section -----------------------------------------------------------
  //
  //  definition of constants and variables
  //
  std::string f_string = "f(z) = "+f_name;
  std::cout<<std::uppercase<<std::scientific<<f_date+"  "+f_string+"  CoStLy Version "+CoStLy::Version()<<std::endl<<std::endl;

  double eps_m006 = 1.0E-6; // CoStLy output: 1+eps=1+1.0E-6
  double eps_m020 = 1.0E-20;
  double eps_m100 = 1.0E-100;
  double eps_m200 = 1.0E-200;
  double eps_m300 = 1.0E-300;
  double eps_p006 = 1.0E+6;
  double eps_p020 = 1.0E+20;
  double eps_p100 = 1.0E+100;
  double eps_p200 = 1.0E+200;
  double eps_p300 = 1.0E+300;

  if( expetal.find( f_name ) < 22 )
    //  function values exceed MAXREAL for |z| > EXP/HYPMAX
    //  because 4*z is sometimes used as the argument, we stick to |z| <= 175
    { 
      eps_p006 = 6;
      eps_p020 = 20;
      eps_p100 = 100;
      eps_p200 = 150;
      eps_p300 = 175;
    }
  else if( tanetal.find( f_name ) < 26 )
    //  for these functions, overflow occurs for certain combinations 
    //  of small and large arguments
    //  to avoid underflow of sqr( sinh( y ) ), modify eps_m200 and eps_m300
    { 
      eps_m200 = 1.0E-125;
      eps_m300 = 1.0E-150;
    }
  else if( f_name == "sqr" )
    //  function values exceed MAXREAL for |z| > SQRT_MAXREAL
    { 
      eps_p100 = 1.0E+50;
      eps_p200 = 1.0E+100;
      eps_p300 = 1.0E+150;
    }

  Interval  x01, y01;
  CInterval z01;
  //
  //-- main section -----------------------------------------------------------
  //
  //  computation of function values for various test intervals
  //
  std::cout<<std::endl<<f_string+": Point intervals"<<std::endl<<std::endl;

  y01 = Interval(eps_m020,eps_m020);

  x01 = Interval(eps_m020,eps_m020);
  my_f8( "z001", x01, y01 );
  x01 = Interval(1,1);
  my_f8( "z002" , x01, y01 );
  x01 = Interval(eps_p020,eps_p020);
  my_f8( "z003" , x01, y01 );

  y01 = Interval(1,1);

  x01 = Interval(1,1);
  my_f8( "z004" , x01, y01 );
  x01 = Interval(eps_p020,eps_p020);
  my_f8( "z005" , x01, y01 );

  y01 = Interval(eps_p020,eps_p020);

  x01 = Interval(eps_p020,eps_p020);
  my_f8( "z006" , x01, y01 );

  y01 = Interval(eps_m300,eps_m300);

  x01 = Interval(eps_m300,eps_m300);
  my_f8( "z007", x01, y01 );
  x01 = Interval(1,1);
  my_f8( "z008" , x01, y01 );
  x01 = Interval(eps_p300,eps_p300);
  my_f8( "z009" , x01, y01 );

  y01 = Interval(1,1);

  x01 = Interval(eps_p300,eps_p300);
  my_f8( "z010" , x01, y01 );

  y01 = Interval(eps_p300,eps_p300);

  x01 = Interval(eps_p300,eps_p300);
  my_f8( "z011" , x01, y01 );

  y01 = Interval(0,0);

  x01 = Interval(eps_m020,eps_m020);
  my_f8( "z012", x01, y01 );
  x01 = Interval(1,1);
  my_f8( "z013" , x01, y01 );
  x01 = Interval(eps_p020,eps_p020);
  my_f8( "z014" , x01, y01 );
  x01 = Interval(eps_m300,eps_m300);
  my_f8( "z015", x01, y01 );
  x01 = Interval(eps_p300,eps_p300);
  my_f8( "z016" , x01, y01 );

  std::cout<<std::endl<<f_string+": Intervals in a single quadrant"<<std::endl<<std::endl;

  y01 = Interval(eps_m006,eps_m006);

  x01 = Interval(eps_m006,1);
  my_f8( "z021", x01, y01 );
  x01 = Interval(1,eps_p006);
  my_f8( "z022" , x01, y01 );
  x01 = Interval(eps_m006,eps_p006);
  my_f8( "z023" , x01, y01 );

  y01 = Interval(eps_m006,1);

  x01 = Interval(eps_m006,1);
  my_f8( "z024", x01, y01 );
  x01 = Interval(1,eps_p006);
  my_f8( "z025" , x01, y01 );
  x01 = Interval(eps_m006,eps_p006);
  my_f8( "z026" , x01, y01 );

  y01 = Interval(eps_m006,eps_p006);

  x01 = Interval(eps_m006,1);
  my_f8( "z027", x01, y01 );
  x01 = Interval(1,eps_p006);
  my_f8( "z028" , x01, y01 );
  x01 = Interval(eps_m006,eps_p006);
  my_f8( "z029" , x01, y01 );

  std::cout<<std::endl<<f_string+": Intervals intersecting an axis"<<std::endl<<std::endl;

  y01 = Interval(-eps_p006,eps_m006);

  x01 = Interval(eps_m006,eps_m006);
  my_f8( "z031", x01, y01 );
  x01 = Interval(1,eps_p006);
  my_f8( "z032" , x01, y01 );

  y01 = Interval(-1,0);

  x01 = Interval(eps_m006,eps_m006);
  my_f8( "z033", x01, y01 );
  x01 = Interval(1,eps_p006);
  my_f8( "z034" , x01, y01 );

  y01 = Interval(0,0);

  x01 = Interval(eps_m006,1-eps_m006);
  my_f8( "z035", x01, y01 );
  x01 = Interval(1+eps_m006,eps_p006);
  my_f8( "z036" , x01, y01 );

  y01 = Interval(0,eps_p006);

  x01 = Interval(eps_m006,1-eps_m006);
  my_f8( "z037", x01, y01 );
  x01 = Interval(1+eps_m006,eps_p006);
  my_f8( "z038" , x01, y01 );

  std::cout<<std::endl<<f_string+": Intervals containing the origin"<<std::endl<<std::endl;

  //  origin
  y01 = Interval(0,0);
  x01 = Interval(0,0);
  z01 = CInterval(x01,y01);
  my_f1( "z041", z01 );

  //  quadruple axes intersection
  y01 = Interval(-eps_m006,1-eps_m006);
      
  x01 = Interval(-1+eps_m006,0.1);
  my_f8( "z042", x01, y01 );
  x01 = Interval(-eps_p006,eps_p100);
  my_f8( "z043" , x01, y01 );
  
  //  double axes intersection (negimags and posreals)
  y01 = Interval(-eps_p006,0);
  
  x01 = Interval(0,eps_m006);
  my_f8( "z044", x01, y01 );
  x01 = Interval(0,eps_p006);
  my_f8( "z045" , x01, y01 );
  
  y01 = Interval(-1+eps_m006,0);
  
  x01 = Interval(0,eps_m006);
  my_f8( "z046", x01, y01 );
  x01 = Interval(0,eps_p006);
  my_f8( "z047" , x01, y01 );
  
  //  triple axes intersection
  y01 = Interval(-1+eps_m006,1-eps_m006);
  
  x01 = Interval(0,eps_m006);
  my_f8( "z048", x01, y01 );
  x01 = Interval(0,eps_p006);
  my_f8( "z049" , x01, y01 );
  
  y01 = Interval(-eps_p006,eps_p006);
  
  x01 = Interval(0,eps_m006);
  my_f8( "z050", x01, y01 );
  x01 = Interval(0,eps_p006);
  my_f8( "z051" , x01, y01 );
  
  //  single axis intersection
  y01 = Interval(0,0);
  
  x01 = Interval(0,eps_m006);
  my_f8( "z052", x01, y01 );
  x01 = Interval(0,eps_p006);
  my_f8( "z053" , x01, y01 );
  
  //  double axes intersection (posreals and posimags)
  y01 = Interval(0,1-eps_m006);
  
  x01 = Interval(0,eps_m006);
  my_f8( "z054", x01, y01 );
  x01 = Interval(0,eps_p006);
  my_f8( "z055" , x01, y01 );
     
  std::cout<<std::endl<<f_string+": Intervals near +1"<<std::endl<<std::endl;

  //  modify the constants according to the purpose of testing
  //  for comparison with with Maple, 1.0 +/- eps_m006 are required
  //  (otherwise, Maple arguments differ from CoStLy arguments)
  //
  //  ONE_P/M_EPS() are used for testing underflow near +/- 1 
  //  (mainly used for testing Asin)
  //
  //  double 
  //    one_meps = 1.0 - eps_m006,
  //    one_peps = 1.0 + eps_m006;
  double 
    one_meps = ONE_MINUS_EPS,
    one_peps = ONE_PLUS_EPS;

  y01 = Interval(-1,-eps_m020);

  x01 = Interval(1,1);
  my_f8( "z061", x01, y01 );
  x01 = Interval(one_peps,one_peps);
  my_f8( "z062", x01, y01 );
  x01 = Interval(one_meps,one_meps);
  my_f8( "z063", x01, y01 );
  x01 = Interval(eps_m006,2);
  my_f8( "z064", x01, y01 );

  y01 = Interval(-eps_m020,-eps_m020);

  x01 = Interval(1,1);
  my_f8( "z065", x01, y01 );
  x01 = Interval(one_peps,one_peps);
  my_f8( "z066", x01, y01 );
  x01 = Interval(one_meps,one_meps);
  my_f8( "z067", x01, y01 );
  x01 = Interval(eps_m006,2);
  my_f8( "z068", x01, y01 );

  y01 = Interval(0,0);

  x01 = Interval(1,1);
  my_f8( "z069", x01, y01 );
  x01 = Interval(one_peps,one_peps);
  my_f8( "z070", x01, y01 );
  x01 = Interval(one_meps,one_meps);
  my_f8( "z071", x01, y01 );
  x01 = Interval(eps_m006,2);
  my_f8( "z072", x01, y01 );

  y01 = Interval(-1,eps_m020);

  x01 = Interval(1,1);
  my_f8( "z073", x01, y01 );
  x01 = Interval(one_peps,one_peps);
  my_f8( "z074", x01, y01 );
  x01 = Interval(one_meps,one_meps);
  my_f8( "z075", x01, y01 );
  x01 = Interval(eps_m006,2);
  my_f8( "z076", x01, y01 );

  y01 = Interval(-eps_p006,-eps_m300);
  x01 = Interval(0.1,3);
  my_f8( "z077", x01, y01 );
  y01 = Interval(-eps_m200,-eps_m300);
  my_f8( "z078", x01, y01 );

  y01 = Interval(-eps_p006,eps_p006);

  x01 = Interval(eps_m300,one_meps);
  my_f8( "z079", x01, y01 );
  x01 = Interval(one_peps,eps_p006);
  my_f8( "z080", x01, y01 );

  std::cout<<std::endl<<f_string+": Intervals near Pi/2 or near Pi"<<std::endl<<std::endl;

  y01 = Interval(0,0);

  x01 = inf( HALFPI() );
  my_f8( "z081", x01, y01 );
  x01 = sup( HALFPI() );
  my_f8( "z082", x01, y01 );
  x01 = HALFPI();
  my_f8( "z083", x01, y01 );
  x01 = inf( PI() );
  my_f8( "z084", x01, y01 );
  x01 = sup( PI() );
  my_f8( "z085", x01, y01 );
  x01 = PI();
  my_f8( "z086", x01, y01 );

  y01 = Interval(-eps_m200,-eps_m200);

  x01 = inf( HALFPI() );
  my_f8( "z087", x01, y01 );
  x01 = sup( HALFPI() );
  my_f8( "z088", x01, y01 );
  x01 = HALFPI();
  my_f8( "z089", x01, y01 );
  x01 = inf( PI() );
  my_f8( "z090", x01, y01 );
  x01 = sup( PI() );
  my_f8( "z091", x01, y01 );
  x01 = PI();
  my_f8( "z092", x01, y01 );

  y01 = Interval(-eps_p006,-eps_m300);
  x01 = Interval(1.1,1.9);
  my_f8( "z093", x01, y01 );

  y01 = Interval(-eps_p006,eps_p006);

  x01 = Interval(1.1,inf( HALFPI() )-eps_m006);
  my_f8( "z094", x01, y01 );
  x01 = Interval(sup( HALFPI() )+eps_m006,1.9);
  my_f8( "z095", x01, y01 );

  y01 = Interval(-eps_p006,-eps_m300);
  x01 = Interval(2.8,3.5);
  my_f8( "z096", x01, y01 );

  y01 = Interval(-eps_p006,eps_p006);

  x01 = Interval(2.8,inf( PI() )-eps_m006);
  my_f8( "z097", x01, y01 );
  x01 = Interval(sup( PI() )+eps_m006,3.5);
  my_f8( "z098", x01, y01 );

  y01 = Interval(-eps_p006,-eps_m020);

  x01 = HALFPI();
  my_f8( "z099", x01, y01 );
  x01 = PI();
  my_f8( "z100", x01, y01 );

  std::cout<<std::endl<<f_string+": Intervals near the origin"<<std::endl<<std::endl;

  y01 = Interval(0,0);

  x01 = Interval(eps_m006,2*eps_m006);
  my_f8( "z101", x01, y01 );
  x01 = Interval(eps_m020,2*eps_m020);
  my_f8( "z102", x01, y01 );

  y01 = Interval(eps_m006,eps_m006);

  x01 = Interval(eps_m006,2*eps_m006);
  my_f8( "z104", x01, y01 );
  x01 = Interval(eps_m020,2*eps_m020);
  my_f8( "z105", x01, y01 );

  y01 = Interval(eps_m020,eps_m020);

  x01 = Interval(eps_m006,2*eps_m006);
  my_f8( "z107", x01, y01 );
  x01 = Interval(eps_m020,2*eps_m020);
  my_f8( "z108", x01, y01 );

  y01 = Interval(eps_m300,eps_m300);

  x01 = Interval(eps_m006,2*eps_m006);
  my_f8( "z110", x01, y01 );
  x01 = Interval(eps_m020,2*eps_m020);
  my_f8( "z111", x01, y01 );

  y01 = Interval(1,1);

  x01 = Interval(eps_m006,2*eps_m006);
  my_f8( "z113", x01, y01 );
  x01 = Interval(eps_m020,2*eps_m020);
  my_f8( "z114", x01, y01 );

  y01 = Interval(eps_m020,1);

  x01 = Interval(eps_m006,2*eps_m006);
  my_f8( "z115", x01, y01 );
  x01 = Interval(eps_m020,2*eps_m020);
  my_f8( "z116", x01, y01 );

  y01 = Interval(-eps_p006,-eps_m300);
  x01 = Interval(-eps_p006,eps_p006);
  my_f8( "z117", x01, y01 );

  y01 = Interval(-eps_p006,eps_p006);

  x01 = Interval(-2.0,-eps_m300);
  my_f8( "z118", x01, y01 );
  x01 = Interval(eps_m300,1.0-eps_m006);
  my_f8( "z119", x01, y01 );
  x01 = Interval(eps_m006,eps_p006);
  my_f8( "z120", x01, y01 );

  std::cout<<std::endl<<f_string+": Underflow"<<std::endl<<std::endl;

  y01 = Interval(0,0);

  x01 = Interval(eps_m100,2*eps_m100);
  my_f8( "z121", x01, y01 );
  x01 = Interval(eps_m200,2*eps_m200);
  my_f8( "z122", x01, y01 );
  x01 = Interval(eps_m300,2*eps_m300);
  my_f8( "z123", x01, y01 );

  y01 = Interval(eps_m100,eps_m100);

  x01 = Interval(eps_m100,2*eps_m100);
  my_f8( "z124", x01, y01 );
  x01 = Interval(eps_m200,2*eps_m200);
  my_f8( "z125", x01, y01 );
  x01 = Interval(eps_m300,2*eps_m300);
  my_f8( "z126", x01, y01 );

  y01 = Interval(eps_m200,eps_m200);

  x01 = Interval(eps_m100,2*eps_m100);
  my_f8( "z127", x01, y01 );
  x01 = Interval(eps_m200,2*eps_m200);
  my_f8( "z128", x01, y01 );
  x01 = Interval(eps_m300,2*eps_m300);
  my_f8( "z129", x01, y01 );

  y01 = Interval(eps_m300,eps_m300);

  x01 = Interval(eps_m100,2*eps_m100);
  my_f8( "z130", x01, y01 );
  x01 = Interval(eps_m200,2*eps_m200);
  my_f8( "z131", x01, y01 );
  x01 = Interval(eps_m300,2*eps_m300);
  my_f8( "z132", x01, y01 );

  y01 = Interval(1,1);

  x01 = Interval(eps_m100,2*eps_m100);
  my_f8( "z133", x01, y01 );
  x01 = Interval(eps_m200,2*eps_m200);
  my_f8( "z134", x01, y01 );
  x01 = Interval(eps_m300,2*eps_m300);
  my_f8( "z135", x01, y01 );

  std::cout<<std::endl<<f_string+": Overflow"<<std::endl<<std::endl;

  y01 = Interval(0,0);

  x01 = Interval(eps_p100,eps_p100);
  my_f8( "z141", x01, y01 );
  x01 = Interval(eps_p100,2*eps_p100);
  my_f8( "z142", x01, y01 );
  x01 = Interval(eps_p200,2*eps_p200);
  my_f8( "z143", x01, y01 );
  x01 = Interval(eps_p300,2*eps_p300);
  my_f8( "z144", x01, y01 );

  y01 = Interval(eps_m100,eps_m100);

  x01 = Interval(eps_p100,eps_p100);
  my_f8( "z145", x01, y01 );
  x01 = Interval(eps_p100,2*eps_p100);
  my_f8( "z146", x01, y01 );
  x01 = Interval(eps_p200,2*eps_p200);
  my_f8( "z147", x01, y01 );
  x01 = Interval(eps_p300,2*eps_p300);
  my_f8( "z148", x01, y01 );

  y01 = Interval(1,1);

  x01 = Interval(eps_p100,eps_p100);
  my_f8( "z149", x01, y01 );
  x01 = Interval(eps_p100,2*eps_p100);
  my_f8( "z150", x01, y01 );
  x01 = Interval(eps_p200,2*eps_p200);
  my_f8( "z151", x01, y01 );
  x01 = Interval(eps_p300,2*eps_p300);
  my_f8( "z152", x01, y01 );

  y01 = Interval(eps_p100,eps_p100);

  x01 = Interval(eps_p100,eps_p100);
  my_f8( "z153", x01, y01 );
  x01 = Interval(eps_p100,2*eps_p100);
  my_f8( "z154", x01, y01 );
  x01 = Interval(eps_p200,2*eps_p200);
  my_f8( "z155", x01, y01 );
  x01 = Interval(eps_p300,2*eps_p300);
  my_f8( "z156", x01, y01 );

  y01 = Interval(eps_p200,eps_p200);

  x01 = Interval(eps_p100,eps_p100);
  my_f8( "z157", x01, y01 );
  x01 = Interval(eps_p100,2*eps_p100);
  my_f8( "z156", x01, y01 );
  x01 = Interval(eps_p200,2*eps_p200);
  my_f8( "z159", x01, y01 );
  x01 = Interval(eps_p300,2*eps_p300);
  my_f8( "z160", x01, y01 );

  y01 = Interval(eps_p300,eps_p300);

  x01 = Interval(eps_p100,eps_p100);
  my_f8( "z161", x01, y01 );
  x01 = Interval(eps_p100,2*eps_p100);
  my_f8( "z162", x01, y01 );
  x01 = Interval(eps_p200,2*eps_p200);
  my_f8( "z163", x01, y01 );
  x01 = Interval(eps_p300,2*eps_p300);
  my_f8( "z164", x01, y01 );

  y01 = Interval(2*eps_p100,4*eps_p100);

  x01 = Interval(eps_p100,eps_p100);
  my_f8( "z165", x01, y01 );
  x01 = Interval(eps_p100,2*eps_p100);
  my_f8( "z166", x01, y01 );
  x01 = Interval(eps_p200,2*eps_p200);
  my_f8( "z167", x01, y01 );
  x01 = Interval(eps_p300,2*eps_p300);
  my_f8( "z168", x01, y01 );

  y01 = Interval(2*eps_p200,4*eps_p200);

  x01 = Interval(eps_p100,eps_p100);
  my_f8( "z169", x01, y01 );
  x01 = Interval(eps_p100,2*eps_p100);
  my_f8( "z170", x01, y01 );
  x01 = Interval(eps_p200,2*eps_p200);
  my_f8( "z171", x01, y01 );
  x01 = Interval(eps_p300,2*eps_p300);
  my_f8( "z172", x01, y01 );

  y01 = Interval(2*eps_p300,4*eps_p300);

  x01 = Interval(eps_p100,eps_p100);
  my_f8( "z173", x01, y01 );
  x01 = Interval(eps_p100,2*eps_p100);
  my_f8( "z174", x01, y01 );
  x01 = Interval(eps_p200,2*eps_p200);
  my_f8( "z175", x01, y01 );
  x01 = Interval(eps_p300,2*eps_p300);
  my_f8( "z176", x01, y01 );

  std::cout<<std::endl<<f_date+"  Results for "+f_string+"  CoStLy Version "+CoStLy::Version()<<std::endl;

  std::cout.rdbuf(buf);

  return 0;
}
