]> www.ginac.de Git - cln.git/blob - src/integer/output/cl_I_decstring.cc
26f9b686a69cb9cefbdb4eecd718d877503725be
[cln.git] / src / integer / output / cl_I_decstring.cc
1 // cl_decimal_string().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cln/integer_io.h"
8
9
10 // Implementation.
11
12 #include "cl_I.h"
13 #include "cl_DS.h"
14 #include "cl_sstring.h"
15
16 namespace cln {
17
18 char * cl_decimal_string (const cl_I& x)
19 {
20         CL_ALLOCA_STACK;
21         var uintL need = cl_digits_need(x,10);
22         var uintB* ziffern = cl_alloc_array(uintB,need); // Platz für die Ziffern
23         var cl_digits erg; erg.LSBptr = &ziffern[need];
24         I_to_digits(x,10,&erg); // Umwandlung in Ziffern
25         var char* result = cl_sstring((char*)erg.MSBptr,erg.len); // Ziffern in String schreiben
26         return result;
27 }
28
29 }  // namespace cln