#include "scltypes.h"
#include "sclfuncs.h"
using namespace scl;
using namespace std;

int main()
{
  const REAL increment = 0.1;
  const REAL count = 25;

  #if defined GNU_GPP_COMPILER
  cout << starbox("/Check gammln function//");
  for (INTEGER i=1; i<=count; ++i) {
    REAL x = increment*REAL(i);
    cout << "x = " << fmt('f',12,8,x) << "  "
         << "lgamma = " << fmt('e',25,17,lgamma(x)) << "  " 
	 << "rel err = " << (lgamma(x)-gammln(x))/(fabs(lgamma(x))+EPS) <<'\n';
  }
  cout << '\n';
  #endif

  //gammln(0.0);
  //gammln(-1.0);

  cout << starbox("/Check gammln function//");
  for (INTEGER i=1; i<=count; ++i) {
    REAL x = increment*REAL(i);
    cout << "x = " << fmt('f',12,8,x) << "  "
         << "gammln = " << fmt('e',25,17,gammln(x)) <<  '\n';
  }

  return 0;
}

