Closed epipping closed 8 years ago
I've pushed another change that simplifies the code further using the *
specified to printf. I'm not sure how portable that is. Found it at
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html
at least. If you rule in favour of this second change, I should probably squash the two commits in a rebase first.
This seems to work on Linux and Windows - all tests are passed at least. This looks like a neat solution. My only thought is that it might be neater to have a #define for maxprecision rather than a function, seeing as everthing is determined at compile time - what do you think?
Happy to hear that. You're right of course, using a function is entirely unnecessary. I've pushed another change.
Instead of determining a formatting string that is suited to the number we're passing to sprintf, we go with the worst case, building on the constants from float.h
I believe this addresses all the suggestions from #1.