ebergman@isis.cs.du.edu (Eric Bergman-Terrell) (04/17/91)
Folks: There is a bug in BC++ 2.0's sprintf routine which shows up in Windows applications - certain floating point numbers don't get ascii-fied correctly. For example, the following doesn't work: sprintf(str, "%f", (float) 24 / 27); After the above call, str has a value of "1.0" but should have a value of "0.8888888888888888". I haven't been able to make this bug happen in DOS but it does occur in Windows. PLEASE DON'T call Borland - I already called this one in and they're working on it. The workaround is to write your own floating-point to ascii conversion routine. Unfortunately the other floating-point to ascii conversion routines in BC++ 2.0 suffer from the same bug (at least the ones I tried - fcvt, ecvt, gcvt, etc). I've written a function to convert floats to the corresponding ascii string - nothing fancy but it works. If there is sufficient interest I'll post it. Hope this message is useful, Terrell