On 04/30/2011 12:56 AM, Janne Blomqvist wrote:
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;
I must have been tired yesterday. Revised chunk. Regression tests OK.
@@ -233,7 +231,13 @@
if (sign_bit)
goto skip;
rchar = '0';
- break;
+ /* Scan for trailing zeros to see if we really need to round it. */
+ for(i = nbefore + nafter; i < ndigits; i++)
+ {
+ if (digits[i] != '0')
+ goto do_rnd;
+ }
+ goto skip;
case ROUND_DOWN:
if (!sign_bit)
goto skip;
OK for trunk?
Jerry