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>
13 // Our private error handling: return to the main program.
17 void cl_abort (void) { longjmp(restartpoint,1); }
20 int main (int argc, char* argv[])
22 for (int i = 1; i < argc; i++) {
23 const char * arg = argv[i];
24 if (setjmp(restartpoint))
26 // Convert argument to its internal representation:
34 const char* separator = "; ";
36 // Split x into integral and fractional part.
37 cl_R_div_t x_split = floor2(x);
38 stdout << x_split.quotient;
39 x = x_split.remainder;
47 stdout << ']' << std::endl;