#include "libscl.h"

using namespace scl;
using namespace std;

int main(int argc, char** argp, char** envp)
{
  
  realmat values;

  values.push_back(0.0);
  values.push_back(1.0);
  values.push_back(2.0);
  values.push_back(0.5*(1.0 + 2.0));
  values.push_back(5.0);
  values.push_back(0.2);
  values.push_back(0.5);
  values.push_back(0.6);
  values.push_back(0.8);
  values.push_back(0.5*(1.0/8.0 + 1.0/16.0));
  values.push_back(0.0095);
  values.push_back(1.19209289550781250e-07);
  values.push_back(REAL_MAX);
  values.push_back(REAL_MAX/2.0);
  REAL a = 0.0;
  REAL b = 0.0;
  values.push_back(a/b);

  values.sort();

  INTEGER n = values.size();

  cout << boolalpha;

  for (INTEGER i=1; i<=n; ++i) {
    cout << '\n';
    REAL x = values[i];
    cout << ' ' << x  << '\t' << ' ' << rb2(x)  << '\n';
    cout << -x << '\t' << rb2(-x) << '\n';
    REAL y = rb2(x);
    cout << ' ' << y  << '\t' << ' ' << rb2(y)  << '\n';
    cout << -y << '\t' << rb2(-y) << '\n';
  }

  cout << '\n';

  for (INTEGER i=1; i<=n; ++i) {
    cout << '\n';
    REAL x  = values[i];
    cout << x << '\n';
    cout << "Same  x returned? " << (x == rb2(x)) << '\n';
    x  = -values[i];
    cout << "Same -x returned? " << (x == rb2(x)) << '\n';
  }


  return 0;
}
