This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problems when using gsl_ran_ugaussian


well,

you have to print a double, not a long int.
try  
printf("%f \n",a) ; 
and  
printf("%f\n",gsl_ran_ugaussian_pdf(1.5)) ;

and you'll get the correct values.

by

af

On Monday 19 May 2003 15:16, Yves Caniou wrote:
> Hi all,
>
> Executing this code :
>
> include <stdio.h>
> #include <stdlib.h>
> #include <gsl/gsl_statistics.h>
>
> int main(int argc,char** argv)
> {
>   double a ;
>
>   a=gsl_ran_ugaussian_pdf(1.5) ;
>   printf("%ld\n",a) ;
>   printf("%ld\n",gsl_ran_ugaussian_pdf(1.5)) ;
>   a=gsl_ran_ugaussian_pdf(1.5) ;
>   printf("%ld\n",a) ;
> }
>
> gives the results 0 32 0 on one of my computer
> and 0 12576 0 on the second one...
> Still, I don't understand these results...
> Thanks.
>
> .Yves.
>
> -: Who is General Failure, and why is he reading my hard drive? :-

-- 
**********************************************************************
Andrea Fortini
Ph.D. Student
Ornstein Laboratorium, room 021
Soft Condensed Matter
Debye Institute, Utrecht University
Princetonplein 5, 3584 CC Utrecht 
The Netherlands
tel.: ++31 (0) 30 253 3519, fax: ++31 (0) 30 253 2706
e-mail: a.fortini@phys.uu.nl 
**********************************************************************


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]