On Mon, Apr 16, 2012 at 11:03, Tobias Burnus
<tobias.bur...@physik.fu-berlin.de> wrote:
> Other patches with pending review:
> - [Patch, libfortran] Combine get_mem and internal_malloc_size
>  http://gcc.gnu.org/ml/fortran/2012-03/msg00127.html

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
>  http://gcc.gnu.org/ml/fortran/2012-04/msg00012.html
>  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;
  }
else
  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

Reply via email to