Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!stanford.edu!jackk@shasta.Stanford.EDU From: jackk@shasta.Stanford.EDU (jackk) Newsgroups: comp.unix.aix Subject: Re: drand48() Keywords: BUG, work as designed Message-ID: <189@shasta.Stanford.EDU> Date: 8 May 91 22:39:14 GMT References: <1991May08.214654.26143@lynx.CS.ORST.EDU> Organization: Stanford University Computer Systems Laboratory Lines: 40 In article <1991May08.214654.26143@lynx.CS.ORST.EDU> ghe@physics.orst.edu writes: >Can anyone tell me what kind result I should expect from the following little >C program? >----- >#include > >main() >{ > int i; > > for (i = 0; i < 10; i++) > printf("%e\n", drand48()); >} >----- > >The answer I got from a RS/6000 is following: >1.531272e-154 >1.531272e-154 >1.531272e-154 > >While the answer from a SUN is >3.964646e-01 >8.404851e-01 > >What is the problem on RS/6000? Is it a BUG in drand48() or is it 'work >as designed'??? :-( :-( > Please read the manual pages for this function. The SUN manual says quite clearly: srand48(), seed48(), and lcong48() are initialization entry points, one of which should be invoked before either ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drand48(), lrand48(), or mrand48() is called. ^^^^^^^^^^^^^^^^ Try following the directions and see if it works. Jack