Re: allocating arrays, trouble



John Harper wrote:
(snip)

But in some systems it's not available, so qp < 0, so REAL(qp) fails. I use compilers both with and without quad precision, and I like to
have a high precision hp that's qp if available, dp if not. The merge
intrinsic could be used to get it in f2003, but not in f95 when defining a parameter. One well-known method that does work in f95 is

INTEGER,PARAMETER:: hp = qp*(1+sign(1,qp))/2 + dp*(1-sign(1,qp))/2

there should be a simpler one that that..

INTEGER,PARAMETER:: hp = dp+(qp-dp)*(1+sign(1,qp))/2

If non-negative qp were always greater than dp:

INTEGER,PARAMETER:: hp = dp+dim(qp,dp)

-- glen

.