On Sat, Apr 30, 2011 at 04:33, Jerry DeLisle <jvdeli...@frontier.com> wrote: > Hi, > > The attached patch does some cleanup and a check for trailing zeros to > decide whether or not to round. > > I have added the additional test cases posted on the bugzilla to the > existing test case round_3.f08. > > Regression tested on x86-64. > > OK for trunk and then I will back port the whole enchilada to 4.6.1 in a few > weeks. Please consider the starting point of the zero scan carefully. I > have not convinced myself that the d * p covers all cases, but it works for > all cases I have tried.
I'm a bit suspicious about that as well: + /* Scan for trailing zeros to see if we really need to round it. */ + for(i = 1 + d * p ; i < ndigits; i++) + { + if (digits[i] != '0') + goto do_rnd; + } + goto skip; legal values for p are (-d, d+2) for E format. Won't this easily overflow if p>1? E.g. 3PE50.36? Then 1 + 36*3 = 109 and ndigits is specified by ndigits = MIN_FIELD_WIDTH - 4 - edigits; If real(16) is available, ndigits= 49-4-4=41. Or am I missing something obvious? -- Janne Blomqvist