This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: Patch for histogram/stat2d.c
- From: Achim Gaedke <Achim dot Gaedke at uni-koeln dot de>
- To: Brian Gough <bjg at network-theory dot co dot uk>
- Cc: Dirk Eddelbuettel <edd at debian dot org>, gsl-discuss at sources dot redhat dot com
- Date: Tue, 05 Mar 2002 23:34:32 +0100
- Subject: Re: Patch for histogram/stat2d.c
- References: <Pine.GSO.3.95.1020305171730.2224B-100000@Octopussy> <20020305182405.GA1056@sonny.eddelbuettel.com> <15493.6859.937797.376221@debian>
Brian Gough schrieb:
>
> Dirk Eddelbuettel writes:
> > On Tue, Mar 05, 2002 at 05:34:21PM +0100, Achim Gaedke wrote:
> > > I saw that you have annonuced gsl-1.1 on the homepage.
> >
> > Hm the mirrors carry that too. Is this now released, Brian?
> >
> > Dirk
>
> Yes, it's released. I sent a message (or at least I thought I sent
> one) to gsl-announce last week but it seems to have disappeared.
>
> Looks like I'll have to do a gsl-1.1.1 release anyway otherwise we'll
> get inundated by this histogram problem.
>
> Brian
Just add an else block to the new condition and you will see the behaviour:
if (wi>0) {
W += wi;
wmean += (xi - wmean) * (wi / W);
}
else {
fprintf(stderr,"wi/W=%g\n", (double)(wi/W));
}
If wi and W is 0, linux prints 0 - but Solaris 5.7 prints NaN .
If wi is 0 and W is not, both print 0.
Please notice the long double variables and the cast to double. If you change
them to double, linux reacts like Solaris. The long doubles are inherited from
histogram/stat.c
I am not shure, which variables tend to be very big/small.
Maybe this is a gcc bug. Please give feedback.
Yours, Achim