Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/22/04 04:27
Read: times


 
#68992 - RE: double to char
Responding to: ???'s previous message
i cant help you on double, Sorry, i am sorta in a rush.

But here is a print int function, maybe you can get an idea from it (recursion on 8051, ack!!) :

sprintint(char* s, int i){
if(i==0) return;
sprintint(s, i/10); //send a higher digit first
i %= 10;
addintTochar(s, i); //before printing this one
}

Ideas:
Logarithm in base 10 will give you how many digits to print on the left of the decimal. :/
Be sure to cut the recursion short should you follow how the above function works
Be sure to make sure the function can print a decimal-only number, unlike an int, a double generally doesn't truncate.

List of 8 messages in thread
TopicAuthorDate
double to char            01/01/70 00:00      
   RE: double to char            01/01/70 00:00      
      RE: double to char            01/01/70 00:00      
   RE: double to char            01/01/70 00:00      
      RE: double to char            01/01/70 00:00      
         RE: double to char            01/01/70 00:00      
   RE: double to char            01/01/70 00:00      
      RE: double to char            01/01/70 00:00      

Back to Subject List