1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

sfio: correct floating decimal point scaling of fractions (#131)

_sfcvt(), "convert a floating point value to ASCII", did not adjust
for negative decimal place movement as what happens with leading
zeroes. This caused ksh's 'printf %f' formatter to fail to round
floating point values correctly.

src/lib/libast/sfio/sfcvt.c:
- Removed constraint of <1e-8 for doubles by matching what was done
  for long doubles having <.1.
- Corrected a condition when the next power of 10 occurred and that
  new 1 digit was being overwritten by a 0.

 src/cmd/ksh93/tests/math.sh:
- Validate that typeset -E/F formatting matches that of their
  equivalent printf formatting options as well as checking for
  correct float scaling of the fractional parts.
This commit is contained in:
hyenias 2020-09-14 06:15:05 -04:00 committed by Martijn Dekker
parent 9f2066f146
commit d7c90eadc3
4 changed files with 67 additions and 9 deletions

5
NEWS
View file

@ -3,6 +3,11 @@ For full details, see the git log at: https://github.com/ksh93/ksh
Any uppercase BUG_* names are modernish shell bug IDs.
2020-09-14:
- Corrected rounding of floating point values by ksh's printf %f formatting
operator. Fix contributed by @hyenias.
2020-09-11:
- The 'command' regular builtin utility (which runs a simple command, removing