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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -