Random numbers problem under Bell Tech.

Matti E. Aarnio mea at funic.funet.fi
Thu Mar 29 05:18:24 AEST 1990


In article <188 at hacker.UUCP> steve at hacker.UUCP (Stephen M. Youndt) writes:
   Simply put, I compile this:
   ---
   main()
   {
     int i;
     srand48(7769);
     for (i=0; i<20; i++)
       printf("%g \n", drand48());
   }
   ---
   run it, get several numbers near to 0 (Ex: 8.32456E-315) then get:
   ---
   Floating exception - core dumped
   ---
   This is on Bell Tech SV3.2u with the BT S/W Dev Platform.   What the hell
   am I doing wrong, and how do I fix it. Please mail answers directly to me.
   Thanks in advance. -- SMY
   -- 
   Stephen M. Youndt         |  "By the time that we realize that ignorance
   "Hacker at Large"         |   truely is bliss, it's already too late" -- ME

Its generic C thing.  Add there statement telling:
  double drand48();
Now it should work.  Default value function return value is int as you
well know...

	/Matti Aarnio <mea at funic.funet.fi>
--
Matti E. Aarnio - Finnish University & Research Network project
<mea at funet.fi> <mea at mea.utu.fi> <mea at funic.funet.fi> <fys-ma at fintuvm.bitnet>
Turku University, WFTL, SF-20500 Turku, Finland -  +358-21-6335917
"Virtually, I don't work, I just netWORK :-)"



More information about the Comp.unix.i386 mailing list