// ----------------------------------------------------------------------
//
// cmathstd.cc - Are <cmath>'s functions in std:: as they ought be?
//
// History:
//   21-Jun-1999  WEB  Initial draft, adapted from Blitz++
//   23-Jun-1999  WEB  Incorporate test for 2-arg <cmath> functions
//   12-Jul-1999  WEB  Restructure to avoid linkage issue
//   20-Aug-1999  WEB  Employ "using" to check out the rest of the fctns
//   07-Sep-1999  WEB  Replace "using" by actual calls to remaining fctns
//   09-Sep-1999  WEB  Get rid of initialization warning
//   15-Feb-2000  WEB  Update to correspond to revised USING macro
//   25-Apr-2001  WEB  s/<ISOcxxSyntax.hh>/"ISOcxx\/ISOcxxSyntax.hh"/
//
// ----------------------------------------------------------------------


#include "ISOcxx/ISOcxxSyntax.hh"

#include <cmath>


BEGIN_NAMESPACE( test )

  double  trial( double & x, double & y )  {

    double  result( 0 );

    // --------------------------------------
    // check out the (double) math functions:
    // --------------------------------------
    result += std::abs  ( x );
    result += std::acos ( x );
    result += std::asin ( x );
    result += std::atan ( x );
    result += std::ceil ( x );
    result += std::cos  ( x );
    result += std::cosh ( x );
    result += std::exp  ( x );
    result += std::fabs ( x );
    result += std::floor( x );
    result += std::log  ( x );
    result += std::log10( x );
    result += std::sin  ( x );
    result += std::sinh ( x );
    result += std::sqrt ( x );
    result += std::tan  ( x );
    result += std::tanh ( x );

    // ---------------------------------------------
    // check out the (double,double) math functions:
    // ---------------------------------------------
    result += std::atan2( x, y );
    result += std::fmod ( x, y );
    result += std::pow  ( x, y );

    // -----------------------------------------------
    // insure the (double,*) math functions are there:
    // -----------------------------------------------
    int iy( STATIC_CAST(int,y) );
    result += std::frexp( x, & iy );
    result += std::ldexp( x, iy   );
    result += std::modf ( x, & y  );
    result += std::pow  ( x, iy   );

    // --------
    // go home:
    // --------
    return  result;

  }  // trial

END_NAMESPACE( test )


// ----------------------------------------------------------------------
// Driver:
// ----------------------------------------------------------------------

int  main()  {

  USING(test::trial)

  double  x( 1.0 )
  ,       y( 1.0 );

  trial( x, y );

  return  0;

}  // main()
