This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

using an individual function from a library? (sprintf)

I don't want to reinvent the wheel (first statement).
I just need to have properly formatted floating point values. Is there a way to get/call JUST the function in sprintf that fomats a fixed field floating point? IE is it possible to JUST link in the code that does "%W.Pf" formating?

I don't need ANY of the other functionality of sprintf. So it just seems to make sense to do this (too me at least).

Although I have written my own I have a problem with it. It splits the float into integer and fractional parts then spits the numbers out for the integer ports then does the same using a multiplication method for the fractional. There is one problem I have run into. When the fractional value is 0.95 or 1.95 and the precision is 1, this cases should alter the integer value, however I'm uncertain how to do this. I was able to correct the other problem of precision+1 issues (IE 1.3 is equal to 1.2999999523 so if the precision is 1 it will print as 1.2 if you don't examine the n+1 digit and round up).

My code should increment the integer portion by one and it doesn't (I've already spat out characters to the buffer for the integer portion). That is a bit difficult to correct, otherwise it would work well (it occupies 564 bytes instead of 1500 bytes).

Stephen

0