This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Fortran] Patch ping

On Mon, Apr 16, 2012 at 11:03, Tobias Burnus
<> wrote:
> Other patches with pending review:
> - [Patch, libfortran] Combine get_mem and internal_malloc_size
> Â

As I said in the original submission, "While the patch is large, it's
also mechanical, hence committed as obvious."

> Approved but not yet committed:

> Janne:
> - [Patch, fortran] PR 49010/24518 MOD/MODULO fixes
> Â
> ÂOkayed but haven't found best wording.

I have an IMHO better wording, namely for MOD(A,P) "the returned value
has the same sign as A and a magnitude less than the magnitude of P."
and for MODULO(A,P) "the returned value has the same sign as P and a
magnitude less than the magnitude of P.". This wording implies what
the sign of the result must be when A is (+-) 0.0 like it does for any
other finite A, which I think is nice.

However, in order to implement this wording, MODULO needs to be
implemented a bit differently than now, namely now we have

res = fmod(a, p);
if (res && ((a < 0) != (p < 0))
  res += p;

but in order to ensure the behavior above for signed zero we need to do

res = fmod(a, p);
if (res)
     if ((a < 0) != (p < 0))
       res += p;
  res = copysign (0.0, p);

I have implemented the compile-time part of this, but I haven't yet
had the time to do the runtime code generation (which should be
conditional on -fsigned-zeros). I'll resubmit when done.

Janne Blomqvist

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]