drand48()

jackk jackk at shasta.Stanford.EDU
Thu May 9 08:39:14 AEST 1991


In article <1991May08.214654.26143 at lynx.CS.ORST.EDU> ghe at physics.orst.edu writes:
>Can anyone tell me what kind result I should expect from the following little
>C program?
>-----
>#include <stdio.h>
>
>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



More information about the Comp.unix.aix mailing list