(j3.2006) parameterized derived types
Bill Long
longb
Tue Dec 8 19:00:23 EST 2015
An example might help. I could see a potential rounding issue with something like a component declaration
real,dimension(INT( SQRT(25.0) * SQRT(121.0) )) :: X
but this is not unique to PDTs. The type parameters themselves are always type integer.
Cheers,
Bill
On Dec 8, 2015, at 2:52 AM, Robert Corbett <robert.corbett at oracle.com> wrote:
> Constraints placed on components of derived types appear to be intended to
> ensure that the values of expressions that appear in derived type definitions
> shall not depend on any nonconstant values other than the values of the type
> parameters. One way in which the constraints fail to do so is that the
> expressions can include floating-point operations whose value depend on the
> rounding mode. The rounding mode might be considered a hidden variable, but the
> standard does not say that. Does any implementation of parameterized derived
> types take the possibility of changing rounding modes into account?
>
> I considered changing the rounding mode to the processor-dependent initial
> rounding mode during elaboration of a type specifier with parameters, but the
> standard does not appear to allow that.
>
> Ensuring that floating-point expressions produce the same values under a single
> rounding mode is difficult but possible given the backends I need to support.
> By default, the optimizers reorder floating-point expressions to produce more
> efficient code. Forcing them not to do so requires giving up many optimization
> that are harmless. The x87 environments are particularly difficult to handle.
>
> Bob Corbett
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101
More information about the J3
mailing list