c - double to char* without any external methods -
i trying convert double precision number in c char* array, cannot use methods such sprintf or outside of stdlib library. trying have mathematical approach find number of digits + dot sign , put each digit int array, hard when precision high, 102.45555
any ideas on how can achieved?
you can go in approach:
cast double int, store digits of int in char array append decimal point subtract int double while don't have sufficient number of digits after decimal point: multiply double 10 cast int , append array subtract int double
Comments
Post a Comment