//#define WANT_OBFUSCATING_OPERATORS
#include <cl_number.h>
#include <cl_io.h>
#include <cl_complex.h>
#include <cl_real.h>
#include <cl_output.h>
//#include <cl_ffloat.h>
//#include <cl_integer.h>
//#include <cl_modinteger.h>
#include <cl_numtheory.h>
#include <cl_timing.h>

#define DUMP(expr)  \
	fprint(cl_stdout, #expr" = "); fprint(cl_stdout, expr); fprint(cl_stdout, "\n");

main (int argc, char* argv[])
{
	(void)argc; (void)argv;

#if 0
	cl_F pi = cl_pi((cl_float_format_t)10000);
	fprint(cl_stdout, pi);
	fprint(cl_stdout, "\n");
#endif

#if 0
	cl_FF a;
	cl_FF x1 = "-0.2173f0";
	cl_FF x2 = "5.5084f9";
	cl_FF y = "-1.19698f9";
	fprint(cl_stdout, "x1 = "); print_float_binary(cl_stdout,x1); fprint(cl_stdout, " = "); fprint(cl_stdout,x1); fprint(cl_stdout, "\n");
	fprint(cl_stdout, "x2 = "); print_float_binary(cl_stdout,x2); fprint(cl_stdout, " = "); fprint(cl_stdout,x2); fprint(cl_stdout, "\n");
	fprint(cl_stdout, "y = "); print_float_binary(cl_stdout,y); fprint(cl_stdout, " = "); fprint(cl_stdout,y); fprint(cl_stdout, "\n");
	cl_FF x = x1*x2;
	fprint(cl_stdout, "x1*x2 = "); print_float_binary(cl_stdout,x); fprint(cl_stdout, " = "); fprint(cl_stdout,x); fprint(cl_stdout, "\n");
#endif

#if 0
	cl_I x = 10;
	cl_I y = ++x;
	x *= 2;
	x++;
	fprint(cl_stdout, "x = "); fprint(cl_stdout, x); fprint(cl_stdout, "\n");
	fprint(cl_stdout, "y = "); fprint(cl_stdout, y); fprint(cl_stdout, "\n");
#endif

#if 0
	cl_I a = "77371252437321868671713407";
	cl_I w;
	cl_boolean squarep = isqrt(a,&w);
	DUMP(squarep);
	DUMP(w);
	DUMP(expt_pos(w,2) <= a);
	DUMP(a < expt_pos(w+1,2));
#endif

#if 0
	cl_I m = "79228162513111556826425457664";
	cl_I a = "19787815858762768436681494528";
	cl_modint_ring R = cl_find_modint_ring(m);
	cl_I b = R->retract(R->canonhom(a));
	cl_I c = mod(a,abs(m));
	DUMP(b);
	DUMP(c);
	DUMP(b==c);
#endif

#if 0
	cl_N x = argv[1];
	cl_N y = sinh(x);
	{ CL_TIMING; y = sinh(x); }
	cout << y << endl;
#endif

	cl_I x = argv[1];
	cout << x << " is " << (isprobprime(x) ? "" : "not ") << "prime" << endl;

}
