1 // Print the continued fraction of a real number.
3 // We work with real numbers and integers.
5 #include <cln/integer.h>
9 #include <cln/integer_io.h>
14 // Our private error handling: return to the main program.
18 void cl_abort (void) { longjmp(restartpoint,1); }
21 int main (int argc, char* argv[])
23 for (int i = 1; i < argc; i++) {
24 const char * arg = argv[i];
25 if (setjmp(restartpoint))
27 // Convert argument to its internal representation:
35 const char* separator = "; ";
37 // Split x into integral and fractional part.
38 cl_R_div_t x_split = floor2(x);
39 cout << x_split.quotient;
40 x = x_split.remainder;