drand48

Bruno Melli bruno at hpfcso.HP.COM
Fri Mar 23 10:44:45 AEST 1990


/ hpfcso:comp.lang.c / root at kunivv1.sci.kun.nl (Privileged Account) /  6:00 am  Mar 21, 1990 /

> when we assign the result of the drand48 function to a variable and
> print it afterwards, the value printed is not between 0 and 1.
> But, when we instead print the result of drand48 directly, the result is
> between 0 and 1.

make sure you have a line like

double drand48();

in your definitions before you call the function. 

Unless told otherwise the compiler assumes that drand48() returns an int.

bruno.



More information about the Comp.lang.c mailing list