Closed tho-ma closed 4 years ago
@tho-ma, I haven't seen your code example before and fixed it different way.
Please check if it works for you. Tests passed on my side for the moment but maybe there are corner cases where it is still failing.
This works for me, Thanks
%g format should always display only significant digits For this line 653 should check for the g format } else if ((in_num < -FLOAT_MAX_B_ENG || in_num > FLOAT_MAX_B_ENG) && def_type != 'g') {
Thank you for yor inputs. I have made changes on develop
branch.
For %g trailing zeros are not removed 4.0f is displayed as 4.00000 4.0e7 is displayed as 4.00000e+7 To correct, use the following statement at line 780: if (p->m.precision > 0 && (dblnum.decimal_part > 0 || def_type != 'g')) {
Additional zero values end up in a loop. Terminate loop by checking in_enum for zero at line 666: for (exp_cnt = 0; in_num < 1 && in_num > 0; in_num *= 10, --exp_cnt) {}