Article 1365 of comp.sources.bugs: Newsgroups: comp.sources.bugs Path: rouge!darwin.sura.net!gatech!swrinde!sdd.hp.com!col.hp.com!news.dtc.hp.com!srgenprp!chrise From: chrise@PROBLEM_WITH_INEWS_GATEWAY_FILE (Chris Eich) Subject: Re: SC 6.21 cell format Sender: news@srgenprp.sr.hp.com (placeholder for future) Message-ID: Date: Tue, 2 Feb 1993 19:00:31 GMT References: <1993Feb1.184619.841@cybvax0.uucp> Organization: HP Santa Rosa Systems Div, CA X-Newsreader: TIN [version 1.1 PL8.7] Lines: 63 With SC 6.21 on BSD 4.2, a cell format with a trailing literal character, a character preceded by a backslash, the value displayed will be rounded down unnecessarily in some cases. Here is a patch, which I'm also mailing to Jeff Buhrt via uunet!nstar!sawmill!prslnk!buhrt (taken from the README file) Chris *** format.c.orig Wed Jan 13 13:24:50 1993 --- format.c Tue Feb 2 10:54:43 1993 *************** *** 245,250 width = 0; if (decimal) { *decimal++ = EOS; for (cp = decimal; *cp != EOS; cp++) { --- 245,251 ----- width = 0; if (decimal) { + int backslashes = 0; *decimal++ = EOS; for (cp = decimal; *cp != EOS; cp++) { *************** *** 252,257 { case '\\': cp++; break; case '#': --- 253,259 ----- { case '\\': cp++; + backslashes++; break; case '#': *************** *** 263,269 break; } } ! zero_pad = strlen(decimal) - zero_pad; } (void) sprintf(prtfmt, "%%.%dlf", width); (void) sprintf(mantissa, prtfmt, val); --- 265,271 ----- break; } } ! zero_pad = strlen(decimal) - backslashes - zero_pad; } (void) sprintf(prtfmt, "%%.%dlf", width); (void) sprintf(mantissa, prtfmt, val);