This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: problems when using gsl_ran_ugaussian
- From: Andrea Fortini <a dot fortini at phys dot uu dot nl>
- To: Yves Caniou <Yves dot Caniou at loria dot fr>,gsl-discuss at sources dot redhat dot com
- Date: Mon, 19 May 2003 16:53:03 +0200
- Subject: Re: problems when using gsl_ran_ugaussian
- References: <200305191516.41750.caniou@loria.fr>
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
**********************************************************************