// cl_decimal_string().

// General includes.
#include "cl_sysdep.h"

// Specification.
#include "cl_print.h"


// Implementation.

#include "cl_I.h"
#include "cl_DS.h"
#include "cl_sstring.h"

char * cl_decimal_string (const cl_I& x)
{
	var uintL need = cl_digits_need(x,10);
	var DYNAMIC_ARRAY(ziffern,uintB,need); // Platz für die Ziffern
	var cl_digits erg; erg.LSBptr = &ziffern[need];
	I_to_digits(x,10,&erg); // Umwandlung in Ziffern
	var char* result = cl_sstring((char*)erg.MSBptr,erg.len); // Ziffern in String schreiben
	FREE_DYNAMIC_ARRAY(ziffern);
	return result;
}
