Re: allocating arrays, trouble
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Mon, 26 Nov 2007 22:38:05 -0800
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
.
- References:
- allocating arrays, trouble
- From: Förster vom Silberwald
- Re: allocating arrays, trouble
- From: Förster vom Silberwald
- Re: allocating arrays, trouble
- From: Arjen Markus
- Re: allocating arrays, trouble
- From: Wade Ward
- Re: allocating arrays, trouble
- From: John Harper
- allocating arrays, trouble
- Prev by Date: Re: Execution times running multiple instances of an application
- Next by Date: Re: Read DOS or Unix files with the same fortran code
- Previous by thread: Re: allocating arrays, trouble
- Next by thread: Re: allocating arrays, trouble
- Index(es):