On 10/15/06, Stephen Moehle smoehle@comcast.net wrote:
Please ignore my previous patch for this. _ecvt and _fcvt needed a lot more work than I first realized. The existing code had at least the following problems: added a decimal point to the output, used scientific notation in the output, did not remove the leading '-' for negative numbers, and got the decimal point offset wrong for numbers like 0.0003. This patch fixes all that and very closely matches the behavior of ecvt an fcvt in glibc and _ecvt and _fcvt in Visual Studio 2005. I have dropped the changes to _gcvt. I will deal with that later.
I have another patch that I will submit shortly that simply implements _ecvt and _fcvt in terms of ecvt_r and fcvt_r. I actually like that patch better since it is much simpler and leverages glibc better. I am submitting both patches because I am not sure why ecvt_r and fcvt_r were not used in the first place. Maybe they are not portable enough or something like that.
I'm not sure that this will be accepted. Portability is really important. I think our float implementation might be wrong from what I remember. You ought to add test cases.