uC-libc : round-off error in gcvt

I fond a bug in gcvt.c, becase the round-off didn't add into the integer part, when the number is 29.997 with digit 2 will be 29.00 .

and I found that just change one number:

k = f + 0.1/scale; f2= f - k;

to

k = f + 0.5/scale; f2= f - k;

this bug is corrected.

  • there are 2 gcvt.c files, one is in libc/math, the other is in libm
Reply to
checko
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.