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: Patch for histogram/stat2d.c


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


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