Sujet : Re: Fortran, no RAN ?
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vmsDate : 18. Jun 2024, 00:49:58
Autres entêtes
Organisation : SunSITE.dk - Supporting Open source
Message-ID : <6670cba7$0$719$14726298@news.sunsite.dk>
References : 1 2 3 4
User-Agent : Mozilla Thunderbird
On 6/17/2024 6:12 PM, Arne Vajhøj wrote:
On 6/17/2024 12:09 AM, Michael Brown wrote:
But the question now is why RAN(I1, I2) works on the VAX compiler,and not on the X86_64 compiler. And what is it doing with those 2 parameters on the VAX so I can simulate it somehow.
Are you sure that it is intrinsic and not something picked
up from some library?
What type is RNDOM? Default REAL*4? Or Integer*4?
If INTEGER*4 then my guess would be that:
RAN(I1, I2)
is:
RAN_INT_IN_INTERVAL(LOW_BOUND, HIGH_BOUND)
But if RNDOM is REAL*4 then my guess would be:
RAN_LONGER_CYCLE(SEED1, SEED2)
Example:
real*4 function ran2arg(seed1, seed2)
implicit none
integer*4 seed1, seed2
integer*4 temp
real*4 dummy
temp = xor(seed1, seed2)
ran2arg = ran(temp)
seed1 = xor(ishc(seed1, 1), temp)
seed2 = xor(ishc(seed2, -1), temp)
end
Disclaimer: I do not know if the cycle from this one is actual longer.
Arne