Article View: comp.sys.amiga.tech
Article #2008Lattice 5.04 problem with drand48??
From: Scot L. Harris
Date: Mon, 06 Nov 1989 02:46
Date: Mon, 06 Nov 1989 02:46
50 lines
3144 bytes
3144 bytes
> The first two programs I tried to compile under 5.04 both
>crashed upon execution. Using CodeProbe it looks like erand48
>from lcm.lib is never returning. The strange thing is that erand48
>isn't even changed in lcm.lib. I tried adding all the new and changed
>modules by hand using oml, but the new lcm.lib still wouldn't work.
>I went back to the 5.02 lcm.lib and everything works fine --- or at
>least as good as it used to work.
>
> ---Todd
>-=-
>
>Todd R. Johnson
>tj@cis.ohio-state.edu
>Laboratory for AI Research
Had similar results here. Have not tried the old lcm.lib but suspect there is
some kind of problem with the floating point calculations. Not sure if this
is true of all floating point stuff or just the random number generator.
I do know the following piece of code knocks the system down HARD.
If the drand48 is replaced by lrand48 it will work ok.
#include <stdio.h>
#include <math.h>
#include <time.h>
void main()
{
double x;
long seed,y;
time(&seed); /* getting the time provides a varying seed value */
printf("time ran and seed= %lx\n",seed);
srand48(seed); /* seed the random number generator */
printf("seed has now been passed to srand48\n");
x = drand48();
printf("Random number = %ld\n",y);
}
--
_
/// /_\ Scot L. Harris !hoptoad!peora!{tarpit,rtmvax}!amigash!scot
\XX/ / \ M I G A
[If you can keep your head when all about you are losing theirs, perhaps
you have misunderstood the situation.]
Technical Details
Message-ID:
<1740.AA1740@amigash>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!utstat!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uwm.edu!bionet!ames!pacbell!hoptoad!peora!tarpit!amigash!scotShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!utstat!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uwm.edu!bionet!ames!pacbell!hoptoad!peora!tarpit!amigash!scot From: scot@amigash.UUCP (Scot L. Harris) Newsgroups: comp.sys.amiga.tech Subject: Lattice 5.04 problem with drand48?? Message-ID: <1740.AA1740@amigash> Date: 6 Nov 89 02:46:22 GMT Followup-To: comp.sys.amiga Lines: 50