This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: strange behaviour with gsl_cdf_fdist_Q()
- From: Szymon Jaroszewicz <sj at cs dot umb dot edu>
- To: Rajarshi Guha <rajarshi at presidency dot com>
- Cc: gsl-discuss at sources dot redhat dot com
- Date: Wed, 3 Sep 2003 17:01:54 -0400 (EDT)
- Subject: Re: strange behaviour with gsl_cdf_fdist_Q()
Do you include proper header files? If function prototypes are not
present some of the .c files may be compiled assuming that your function
returns an int (the default) and others assuming correctly that it returns
a double. Then an integer value is treated as a double giving absurd
results. I had a similar problem once... It might also help to remove
all object (.o) files and recompile everyting from scratch...
Szymon
On 3 Sep 2003, Rajarshi Guha wrote:
> On Wed, 2003-09-03 at 13:04, Rajarshi Guha wrote:
> > Hi,
> > more problems with gsl_cdf_fdist_Q() and very strange ones at that!
>
> I've been investigating this problem a little more.
>
> I took the code from fdist.c and beta_inc.c and basically renamed the
> functions and compiled the code directly into my binary. Now running my
> program gives different values of P inside the function and absurd
> values of the return value after it has returned from the function!
>
> With the original gsl_* function from the GSL libs:
>
> x = 3.145724 nu1 = 7.666667 nu2 = 3.000000 P = 0.044555
> return value = 32.0000
>
> When I call the renamed funtion in my binary I get
>
> x = 3.145724 nu1 = 7.666667 nu2 = 3.000000 P = 0.000981
> return value = 521874777.0000
>
> Assuming that there is a problem somewhere I would have expected that
> whether I called the code from the library or my own program, the
> answers would be consistent.
>
> Is there some detail of the GSL internals that might lead to this
> difference? I'm still assuming the problem lies in my code - some form
> of memory corruption somewhere, b ut as soon as I get rid of calls to
> gsl_cdf_fdist_Q(), the program runs fine and produces the expected
> results.
>
> Thanks,
>
> -------------------------------------------------------------------
> Rajarshi Guha <rajarshi@presidency.com> <http://jijo.cjb.net>
> GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
> -------------------------------------------------------------------
> A committee is a group that keeps the minutes and loses hours.
> -- Milton Berle
>
>