Answer the question
In order to leave comments, you need to log in
Does a random number generator SOMETIMES (very rarely!) return NaN?
I'm doing scientific calculations, and suddenly I discovered a very strange effect. If you call the Intel (integrated in Intel Fortran) generator of uniformly distributed random numbers (0.1) many times in a row, then on some computers (so far there are 4 out of 5 tested) after about A = 50 million calls (the exact figure varies, see more details). see the link below) it starts quasi-periodically, with a period of about B=10 million calls, to return NaN.
UPD : Thanks to Tony 's leading question , I want to clarify one important nuance: even when generating the same PSN sequences (SEED initialization with the same constant), NANs appear in different places every time they start.
Answer the question
In order to leave comments, you need to log in
I read the thread and I can make an input: either magic happens, that is, we attribute everything to magnetic storms on Jupiter, or we still need to dig.
If the bug reproduces absolutely chaotically, then I can assume (from my C ++ experience) that someone somewhere spoils the heap and you end up with garbage.
By the way, I understand that Rand in Fortran produces a number of type float / double because I do not understand how NaN is possible in integers.
Question: if you write a simple naked program in which there will be only one call to the main function (well, or whatever in Fortran, I'm sorry, I don't know) and only in this function in the loop call Rand and nothing else.
NaN - appears???
PS can you attach an asm listing of the Rand function?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question