* [9fans] Bug in print(2) g verb @ 2013-02-28 2:49 Paul Patience 2013-03-01 0:08 ` Rob Pike 0 siblings, 1 reply; 26+ messages in thread From: Paul Patience @ 2013-02-28 2:49 UTC (permalink / raw) To: 9fans I already sent this mail, but it seems that 9fans didn't receive it. The g verb in print(2) does not work properly. The precision flag (%.ng) is supposed to print n significant figures, but it prints n+1 significant figures. This change fixes this behaviour. diff -r d6b623d4cac0 sys/src/libc/fmt/fltfmt.c --- a/sys/src/libc/fmt/fltfmt.c Sat Feb 23 14:05:51 2013 +0100 +++ b/sys/src/libc/fmt/fltfmt.c Wed Feb 27 15:59:34 2013 -0500 @@ -187,6 +187,8 @@ * c3 digits of trailing '0' * c4 digits after '.' */ + if(chr == 'g') /* Significant figures. */ + prec--; c1 = 0; c2 = prec + 1; c3 = 0; ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] Bug in print(2) g verb 2013-02-28 2:49 [9fans] Bug in print(2) g verb Paul Patience @ 2013-03-01 0:08 ` Rob Pike 2013-03-01 2:57 ` Paul A. Patience 2013-03-01 4:54 ` Kurt H Maier 0 siblings, 2 replies; 26+ messages in thread From: Rob Pike @ 2013-03-01 0:08 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs In plan9port at least, it seems correct. %.5g prints 12346 given 12345.67890. Do you have an example it gets wrong? -rob ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] Bug in print(2) g verb 2013-03-01 0:08 ` Rob Pike @ 2013-03-01 2:57 ` Paul A. Patience 2013-03-01 4:54 ` Kurt H Maier 1 sibling, 0 replies; 26+ messages in thread From: Paul A. Patience @ 2013-03-01 2:57 UTC (permalink / raw) To: 9fans Without the change, it should get any example wrong. This is with native Plan 9, though. Plan9port's fltfmt.c is not the same, so it must be working correctly. term% cat foo.c #include <u.h> #include <libc.h> void main(void) { print("%.5g\n", 12345.67890); exits(nil); } term% 8.out 12345.7 ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] Bug in print(2) g verb 2013-03-01 0:08 ` Rob Pike 2013-03-01 2:57 ` Paul A. Patience @ 2013-03-01 4:54 ` Kurt H Maier 2013-03-01 15:30 ` Rob Pike 1 sibling, 1 reply; 26+ messages in thread From: Kurt H Maier @ 2013-03-01 4:54 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs On Thu, Feb 28, 2013 at 04:08:24PM -0800, Rob Pike wrote: > In plan9port at least, it seems correct. He wasn't asking about plan9port. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] Bug in print(2) g verb 2013-03-01 4:54 ` Kurt H Maier @ 2013-03-01 15:30 ` Rob Pike 2013-03-01 15:58 ` Steve Simon ` (2 more replies) 0 siblings, 3 replies; 26+ messages in thread From: Rob Pike @ 2013-03-01 15:30 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs But the code looks the same in plan9port at that point. So it looks like a fix was made somewhere else in that file and not put back into the Plan 9 sources. The proposed fix is perhaps not the best one. -rob ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] Bug in print(2) g verb 2013-03-01 15:30 ` Rob Pike @ 2013-03-01 15:58 ` Steve Simon 2013-03-01 17:38 ` Anthony Sorace 2013-03-01 22:53 ` Paul A. Patience 2013-03-03 17:57 ` [9fans] Bug in print(2) g verb Paul A. Patience 2 siblings, 1 reply; 26+ messages in thread From: Steve Simon @ 2013-03-01 15:58 UTC (permalink / raw) To: 9fans > So it looks > like a fix was made somewhere else in that file and not put back into > the Plan 9 sources. Just an idea, but now that gcc has kenc compatibility modes thanks to a GO author, plan9ports could be merged back with mainline plan9 to a large extent. It could then become a much smaller porting layer and a script which pulls down much of /sys/src/cmd from plan9. The idea is for both communities to take advantage of each others bug fixes and enhancements. This relies on gcc running everywhere p9p runs (which may or may not be true), and somone with the time to do the work... -Steve ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] Bug in print(2) g verb 2013-03-01 15:58 ` Steve Simon @ 2013-03-01 17:38 ` Anthony Sorace 0 siblings, 0 replies; 26+ messages in thread From: Anthony Sorace @ 2013-03-01 17:38 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs On Mar 1, 2013, at 10:58, "Steve Simon" <steve@quintile.net> wrote: > This relies on gcc running everywhere p9p runs... s/gcc/sufficiently modern gcc/ I think that's the bigger issue. How far back in time is p9p looking to support platforms from? I have at least one box in the basement with a much older gcc on it. In my particular case, nothing prevents me from upgrading (except how painful dealing with gcc is), but I doubt that's true for everyone. Relatedly, does anyone happen to know whether clang/llvm have these extensions as well? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] Bug in print(2) g verb 2013-03-01 15:30 ` Rob Pike 2013-03-01 15:58 ` Steve Simon @ 2013-03-01 22:53 ` Paul A. Patience 2013-03-03 17:33 ` erik quanstrom 2013-03-03 18:54 ` [9fans] doing a native awk port (was Re: Bug in print(2) g verb) arnold 2013-03-03 17:57 ` [9fans] Bug in print(2) g verb Paul A. Patience 2 siblings, 2 replies; 26+ messages in thread From: Paul A. Patience @ 2013-03-01 22:53 UTC (permalink / raw) To: 9fans Plan9port's implementation of fltfmt.c seems different enough to me that it isn't possible to simply take the fix from there and add it to plan9. Perhaps I'm missing something. The g verb already acts differently in plan9port and native plan 9: print("%g\n", 0.1) prints .1 in plan 9 and 0.1 in plan9port. I don't why they're different, but the former behaviour is unfortunate for the native port of awk I am completing (started by boyd). Others are of course welcome to come up with fixes for this problem. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] Bug in print(2) g verb 2013-03-01 22:53 ` Paul A. Patience @ 2013-03-03 17:33 ` erik quanstrom 2013-03-03 21:43 ` Richard Miller 2013-03-03 18:54 ` [9fans] doing a native awk port (was Re: Bug in print(2) g verb) arnold 1 sibling, 1 reply; 26+ messages in thread From: erik quanstrom @ 2013-03-03 17:33 UTC (permalink / raw) To: paul-a.patience, 9fans On Fri Mar 1 17:54:53 EST 2013, paul-a.patience@polymtl.ca wrote: > Plan9port's implementation of fltfmt.c seems > different enough to me that it isn't possible to > simply take the fix from there and add it to > plan9. Perhaps I'm missing something. > > The g verb already acts differently in plan9port > and native plan 9: print("%g\n", 0.1) prints .1 in > plan 9 and 0.1 in plan9port. I don't why they're > different, but the former behaviour is unfortunate > for the native port of awk I am completing > (started by boyd). > > Others are of course welcome to come up with fixes > for this problem. here are all the places where %g is used with a prec. i think this should be trivial to fix. we just need to agree to fix it. i would vote for fixing it. - erik --- chula; g '%([# +]|-)?([*0-9]+)?(\.[*0-9]+)g' /sys/src|grep -v printf|grep -v '/awk/|/gs/' /sys/src/ape/lib/fmt/test.c:34: print("%2.18g\n", 1.0); /sys/src/cmd/aux/msexceltables.c:286: Bprint(bo, "%-*.*g", min, max, c->number); /sys/src/cmd/aux/vga/main.c:331: trace("refresh %.1g\n", rr); /sys/src/cmd/aux/vga/main.c:333: fprint(2, "reducing %.1g to 85Hz\n", rr); /sys/src/cmd/du.c:65: print("%.6g%s\t%q\n", val, pfxes[scale], name); /sys/src/cmd/du.c:67: print("%.6g\t%q\n", (double)amt/unit, name); /sys/src/cmd/hoc/code.c:586: print("%.12g\n", d.val); /sys/src/cmd/hoc/code.c:595: print("%.12g ", d.val); /sys/src/cmd/ip/gping.c:936: seprint(g->msg+n, e, " %3.3g", f/1000000); /sys/src/cmd/nettest.c:143: print("%llud bytes in %g s @ %.2g MB/s (%ldms; limit %.2g MB/s)\n", i, delta, ratemb, sleepms, maxr); /sys/src/cmd/nettest.c:146: print("%llud bytes in %g s @ %.2g MB/s (0ms)\n", i, delta, ratemb); /sys/src/games/mp3enc/timestatus.c:153: "%9.4f" SPEED_CHAR "|" : "%#9.5g" SPEED_CHAR "|", /sys/src/libmach/machdata.c:209: return snprint(buf, n, "%.18g", fr); /sys/src/libmach/machdata.c:242: return snprint(buf, n, "%.9g", fr); /sys/src/libstdio/dtoa.c:8: * printed as %.17g. Then atof(s) is exactly y. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] Bug in print(2) g verb 2013-03-03 17:33 ` erik quanstrom @ 2013-03-03 21:43 ` Richard Miller 2013-03-03 21:52 ` erik quanstrom 0 siblings, 1 reply; 26+ messages in thread From: Richard Miller @ 2013-03-03 21:43 UTC (permalink / raw) To: 9fans > /sys/src/cmd/hoc/code.c:586: print("%.12g\n", d.val); Conceivably changing this could break somebody's rc script which depends on hoc leaving out the leading zero. But unlikely (one hopes) that someone with the taste to use Plan 9 would write anything so fragile... I vote we converge with plan9port's behaviour on this. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] Bug in print(2) g verb 2013-03-03 21:43 ` Richard Miller @ 2013-03-03 21:52 ` erik quanstrom 0 siblings, 0 replies; 26+ messages in thread From: erik quanstrom @ 2013-03-03 21:52 UTC (permalink / raw) To: 9fans > Conceivably changing this could break somebody's rc script which depends on > hoc leaving out the leading zero. But unlikely (one hopes) that someone with > the taste to use Plan 9 would write anything so fragile... looks like /rc/bin is safe, but ironicly, uptime(1) hacks around the current behavior. - erik ^ permalink raw reply [flat|nested] 26+ messages in thread
* [9fans] doing a native awk port (was Re: Bug in print(2) g verb) 2013-03-01 22:53 ` Paul A. Patience 2013-03-03 17:33 ` erik quanstrom @ 2013-03-03 18:54 ` arnold 2013-03-03 19:04 ` Paul A. Patience 2013-03-03 19:07 ` erik quanstrom 1 sibling, 2 replies; 26+ messages in thread From: arnold @ 2013-03-03 18:54 UTC (permalink / raw) To: 9fans Changing the subject here... "Paul A. Patience" <paul-a.patience@polymtl.ca> wrote: > .... > for the native port of awk I am completing > (started by boyd). I was under the impression that awk was a native port, but I could be wrong. In any case, I recommend that you start with BWK's latest, which is availble on github: git clone git://github.com/onetrueawk/awk And also talk to Erik who did some work on bringing the Plan 9 awk into sync with BWK's a little while back. HTH, Arnold P.S. The git repo includes his test suite in the file awktest.a; it should probably be unarchived in a separate directory from the source. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] doing a native awk port (was Re: Bug in print(2) g verb) 2013-03-03 18:54 ` [9fans] doing a native awk port (was Re: Bug in print(2) g verb) arnold @ 2013-03-03 19:04 ` Paul A. Patience 2013-03-03 19:08 ` erik quanstrom 2013-03-03 19:07 ` erik quanstrom 1 sibling, 1 reply; 26+ messages in thread From: Paul A. Patience @ 2013-03-03 19:04 UTC (permalink / raw) To: 9fans I am actually the one who asked bwk for his test suite, which he later put on github. I started with some gawk tests while waiting for the test suite, however. As for plan9's awk, it runs on ape. I am trying to make it run without ape. I had thought of starting with the latest version of awk, but boyd's port was nearly complete (it's in contrib). All I've been doing is making small bugfixes here and there. I'm not finished yet, but it won't be too much longer, hopefully. Perhaps after that I can take a look at the latest awk. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] doing a native awk port (was Re: Bug in print(2) g verb) 2013-03-03 19:04 ` Paul A. Patience @ 2013-03-03 19:08 ` erik quanstrom 2013-03-03 19:11 ` Kurt H Maier 0 siblings, 1 reply; 26+ messages in thread From: erik quanstrom @ 2013-03-03 19:08 UTC (permalink / raw) To: 9fans > As for plan9's awk, it runs on ape. I am trying > to make it run without ape. I had thought of don't. it's not worth it. - erik ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] doing a native awk port (was Re: Bug in print(2) g verb) 2013-03-03 19:08 ` erik quanstrom @ 2013-03-03 19:11 ` Kurt H Maier 2013-03-03 19:18 ` erik quanstrom 0 siblings, 1 reply; 26+ messages in thread From: Kurt H Maier @ 2013-03-03 19:11 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs On Sun, Mar 03, 2013 at 02:08:20PM -0500, erik quanstrom wrote: > > As for plan9's awk, it runs on ape. I am trying > > to make it run without ape. I had thought of > > don't. it's not worth it. > > - erik > [citation needed] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] doing a native awk port (was Re: Bug in print(2) g verb) 2013-03-03 19:11 ` Kurt H Maier @ 2013-03-03 19:18 ` erik quanstrom 2013-03-03 19:28 ` Kurt H Maier 0 siblings, 1 reply; 26+ messages in thread From: erik quanstrom @ 2013-03-03 19:18 UTC (permalink / raw) To: 9fans On Sun Mar 3 14:12:19 EST 2013, khm-9@intma.in wrote: > On Sun, Mar 03, 2013 at 02:08:20PM -0500, erik quanstrom wrote: > > > As for plan9's awk, it runs on ape. I am trying > > > to make it run without ape. I had thought of > > > > don't. it's not worth it. > > > > - erik > > > > [citation needed] uh, no. this is obvious. awk is designed for a posix environment. ape is the plan 9 posix environment. they'll be happy together. - erik ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] doing a native awk port (was Re: Bug in print(2) g verb) 2013-03-03 19:18 ` erik quanstrom @ 2013-03-03 19:28 ` Kurt H Maier 2013-03-03 19:31 ` erik quanstrom 0 siblings, 1 reply; 26+ messages in thread From: Kurt H Maier @ 2013-03-03 19:28 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs On Sun, Mar 03, 2013 at 02:18:11PM -0500, erik quanstrom wrote: > awk is designed for a posix environment. bullshit. was ls also designed for a posix environment? awk is at least ten years older than posix. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] doing a native awk port (was Re: Bug in print(2) g verb) 2013-03-03 19:28 ` Kurt H Maier @ 2013-03-03 19:31 ` erik quanstrom 2013-03-03 19:35 ` Kurt H Maier 2013-03-04 0:10 ` Dan Cross 0 siblings, 2 replies; 26+ messages in thread From: erik quanstrom @ 2013-03-03 19:31 UTC (permalink / raw) To: 9fans On Sun Mar 3 14:29:15 EST 2013, khm-9@intma.in wrote: > On Sun, Mar 03, 2013 at 02:18:11PM -0500, erik quanstrom wrote: > > awk is designed for a posix environment. > > bullshit. was ls also designed for a posix environment? awk is at > least ten years older than posix. should i say "the current ot awk source"? it's certainly not designed for plan 9. - erik ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] doing a native awk port (was Re: Bug in print(2) g verb) 2013-03-03 19:31 ` erik quanstrom @ 2013-03-03 19:35 ` Kurt H Maier 2013-03-04 0:10 ` Dan Cross 1 sibling, 0 replies; 26+ messages in thread From: Kurt H Maier @ 2013-03-03 19:35 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs On Sun, Mar 03, 2013 at 02:31:07PM -0500, erik quanstrom wrote: > On Sun Mar 3 14:29:15 EST 2013, khm-9@intma.in wrote: > > On Sun, Mar 03, 2013 at 02:18:11PM -0500, erik quanstrom wrote: > > > awk is designed for a posix environment. > > > > bullshit. was ls also designed for a posix environment? awk is at > > least ten years older than posix. > > should i say "the current ot awk source"? it's certainly not > designed for plan 9. > > - erik > That wasn't the section of the message you quoted. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] doing a native awk port (was Re: Bug in print(2) g verb) 2013-03-03 19:31 ` erik quanstrom 2013-03-03 19:35 ` Kurt H Maier @ 2013-03-04 0:10 ` Dan Cross 2013-03-04 0:39 ` Kurt H Maier 1 sibling, 1 reply; 26+ messages in thread From: Dan Cross @ 2013-03-04 0:10 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/plain, Size: 357 bytes --] On Sun, Mar 3, 2013 at 2:31 PM, erik quanstrom <quanstro@quanstro.net>wrote: > should i say "the current ot awk source"? it's certainly not > designed for plan 9. > Regardless you are right that it is clearly not worth porting to 'native' Plan 9 libraries or APIs; what, if anything, would be the benefit of such an effort? - Dan C. [-- Attachment #2: Type: text/html, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] doing a native awk port (was Re: Bug in print(2) g verb) 2013-03-04 0:10 ` Dan Cross @ 2013-03-04 0:39 ` Kurt H Maier 0 siblings, 0 replies; 26+ messages in thread From: Kurt H Maier @ 2013-03-04 0:39 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs On Sun, Mar 03, 2013 at 07:10:09PM -0500, Dan Cross wrote: > On Sun, Mar 3, 2013 at 2:31 PM, erik quanstrom <quanstro@quanstro.net>wrote: > > > should i say "the current ot awk source"? it's certainly not > > designed for plan 9. > > > > Regardless you are right that it is clearly not worth porting to 'native' > Plan 9 libraries or APIs; what, if anything, would be the benefit of such > an effort? > > - Dan C. Not worth *what*? Someone else's time? The only reason we're talking about a bug in print(2) is because of this waste-of-time native awk work. This isn't some kind of zero-sum game where the opportunity cost of someone making a native awk is depriving us of valuable other software. Pretty much anything anyone writes for plan 9 is 'not worth it' from an economical perspective; pretending Program A is worth less than Program B is a little silly. In the meantime Paul has fun, finds bugs to fix, and I'm one step closer to eradicating ape on my systems. He doesn't answer to 9fans; stop trying to get him to justify himself to you. khm ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] doing a native awk port (was Re: Bug in print(2) g verb) 2013-03-03 18:54 ` [9fans] doing a native awk port (was Re: Bug in print(2) g verb) arnold 2013-03-03 19:04 ` Paul A. Patience @ 2013-03-03 19:07 ` erik quanstrom 2013-03-03 21:29 ` Richard Miller 1 sibling, 1 reply; 26+ messages in thread From: erik quanstrom @ 2013-03-03 19:07 UTC (permalink / raw) To: arnold, 9fans On Sun Mar 3 13:55:37 EST 2013, arnold@skeeve.com wrote: > Changing the subject here... > > "Paul A. Patience" <paul-a.patience@polymtl.ca> wrote: > > > .... > > for the native port of awk I am completing > > (started by boyd). > > I was under the impression that awk was a native port, but I could > be wrong. > > In any case, I recommend that you start with BWK's latest, which is > availble on github: > > git clone git://github.com/onetrueawk/awk > > And also talk to Erik who did some work on bringing the Plan 9 awk into > sync with BWK's a little while back. this is a long-finished project, which is included in 9atom. i've been happy with the results. there haven't been any odd fpes with venti scores or what have you. i thought this had been submitted, but i guess not. if there is any interest, i would be happy to submit it. - erik ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] doing a native awk port (was Re: Bug in print(2) g verb) 2013-03-03 19:07 ` erik quanstrom @ 2013-03-03 21:29 ` Richard Miller 2013-03-03 21:38 ` erik quanstrom 0 siblings, 1 reply; 26+ messages in thread From: Richard Miller @ 2013-03-03 21:29 UTC (permalink / raw) To: 9fans >> And also talk to Erik who did some work on bringing the Plan 9 awk into >> sync with BWK's a little while back. >... > if there is any > interest, i would be happy to submit it. Here's one vote in favour. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] doing a native awk port (was Re: Bug in print(2) g verb) 2013-03-03 21:29 ` Richard Miller @ 2013-03-03 21:38 ` erik quanstrom 0 siblings, 0 replies; 26+ messages in thread From: erik quanstrom @ 2013-03-03 21:38 UTC (permalink / raw) To: 9fans On Sun Mar 3 16:30:37 EST 2013, 9fans@hamnavoe.com wrote: > >> And also talk to Erik who did some work on bringing the Plan 9 awk into > >> sync with BWK's a little while back. > >... > > if there is any > > interest, i would be happy to submit it. > > Here's one vote in favour. good enough! /n/sources/patch/bwk-awk-update - erik ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] Bug in print(2) g verb 2013-03-01 15:30 ` Rob Pike 2013-03-01 15:58 ` Steve Simon 2013-03-01 22:53 ` Paul A. Patience @ 2013-03-03 17:57 ` Paul A. Patience 2013-03-03 18:26 ` erik quanstrom 2 siblings, 1 reply; 26+ messages in thread From: Paul A. Patience @ 2013-03-03 17:57 UTC (permalink / raw) To: 9fans I would also like it if %g acted the same in plan9 as everywhere else (printing 0.1 instead of .1 in my example). That's also really easy to change. It doesn't make sense for plan9port's %g to be different from plan9, because now you cannot even count on both prints to work the same way. Since printf's %g works like plan9port right now, it would make sense to change plan9's version. I don't know the history behind %g's current behaviour, however. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [9fans] Bug in print(2) g verb 2013-03-03 17:57 ` [9fans] Bug in print(2) g verb Paul A. Patience @ 2013-03-03 18:26 ` erik quanstrom 0 siblings, 0 replies; 26+ messages in thread From: erik quanstrom @ 2013-03-03 18:26 UTC (permalink / raw) To: 9fans On Sun Mar 3 12:57:49 EST 2013, paul-a.patience@polymtl.ca wrote: > I would also like it if %g acted the same in plan9 > as everywhere else (printing 0.1 instead of .1 in > my example). That's also really easy to change. > > It doesn't make sense for plan9port's %g to be > different from plan9, because now you cannot even > count on both prints to work the same way. Since > printf's %g works like plan9port right now, it > would make sense to change plan9's version. > > I don't know the history behind %g's current > behaviour, however. i don't have access to 3e sources, but 2e does not add the extra digit like current plan 9 source does. (it does however omit the leading 0 on 0.1.) looking at the differences, i think there's a clue in the 2e comments /* * n is number of digits to convert * 1 before, f2 after, 1 extra for rounding */ we can see that after the label "found:" c1 is set to prec+1, but that's including the rounding digit. (cf. "try decimal rounding" above.) it looks like a simple error in converting the code from the old non-va_args style to the current style. - erik p.s. i haven't talked to anyone to wrote the code, so maybe somebody who knows more about this than i could chime in? ^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2013-03-04 0:39 UTC | newest] Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-02-28 2:49 [9fans] Bug in print(2) g verb Paul Patience 2013-03-01 0:08 ` Rob Pike 2013-03-01 2:57 ` Paul A. Patience 2013-03-01 4:54 ` Kurt H Maier 2013-03-01 15:30 ` Rob Pike 2013-03-01 15:58 ` Steve Simon 2013-03-01 17:38 ` Anthony Sorace 2013-03-01 22:53 ` Paul A. Patience 2013-03-03 17:33 ` erik quanstrom 2013-03-03 21:43 ` Richard Miller 2013-03-03 21:52 ` erik quanstrom 2013-03-03 18:54 ` [9fans] doing a native awk port (was Re: Bug in print(2) g verb) arnold 2013-03-03 19:04 ` Paul A. Patience 2013-03-03 19:08 ` erik quanstrom 2013-03-03 19:11 ` Kurt H Maier 2013-03-03 19:18 ` erik quanstrom 2013-03-03 19:28 ` Kurt H Maier 2013-03-03 19:31 ` erik quanstrom 2013-03-03 19:35 ` Kurt H Maier 2013-03-04 0:10 ` Dan Cross 2013-03-04 0:39 ` Kurt H Maier 2013-03-03 19:07 ` erik quanstrom 2013-03-03 21:29 ` Richard Miller 2013-03-03 21:38 ` erik quanstrom 2013-03-03 17:57 ` [9fans] Bug in print(2) g verb Paul A. Patience 2013-03-03 18:26 ` erik quanstrom
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).