diff options
author | wlemb <wlemb> | 2003-12-18 17:19:26 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2003-12-18 17:19:26 +0000 |
commit | 2da12cfd4b7239ba5c20574842f43ab9344ba579 (patch) | |
tree | b314cdecf51f26890590213c86f0d96ff0096c5c | |
parent | adefc1cf704fa2fd8574e5d87d4a3be825ffbc93 (diff) | |
download | groff-2da12cfd4b7239ba5c20574842f43ab9344ba579.tar.gz |
* src/devices/grops/ps.cc (ps_output::put_float): Revert change
from 2001-10-04.
Remove trailing zeros.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/devices/grops/ps.cpp | 10 |
2 files changed, 14 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2003-12-18 Werner LEMBERG <wl@gnu.org> + + * src/devices/grops/ps.cc (ps_output::put_float): Revert change + from 2001-10-04. + Remove trailing zeros. + 2003-12-17 Werner LEMBERG <wl@gnu.org> Make \? transparent to end-of-sentence recognition. diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp index 4084c85e..60be928e 100644 --- a/src/devices/grops/ps.cpp +++ b/src/devices/grops/ps.cpp @@ -329,8 +329,14 @@ ps_output &ps_output::put_fix_number(int i) ps_output &ps_output::put_float(double d) { char buf[128]; - sprintf(buf, "%.3g", d); - int len = strlen(buf); + sprintf(buf, "%.4f", d); + int last = strlen(buf) - 1; + while (buf[last] == '0') + last--; + if (buf[last] == '.') + last--; + buf[++last] = '\0'; + int len = last + 1; if (col > 0 && col + len + need_space > max_line_length) { putc('\n', fp); col = 0; |