This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH for PR 14699
Serge Belyshev <1319@bot.ru> writes:
> folded together:
>
> -----------------------------------------------
> |
> | N / N \ 2
> | ---- | ---- |
> | 1 \ 2 1 | \ |
> S = \ | --- ) X + --- | ) X |
> \ | N / i 2 | / i |
> \ | ---- N | ---- |
> \| i = 1 \ i = 1 /
>
>
> but exact variant is:
>
> -----------------------------------------------
> |
> | N / N \ 2
> | ---- | ---- |
> | 1 \ 2 1 | \ |
> S = \ | --- ) X + ------ | ) X |
> \ | N-1 / i N (N-1) | / i |
> \ | ---- | ---- |
> \| i = 1 \ i = 1 /
>
Ah, yes, thank you for clarifying.
> (exp_len2 - exp2_len) becomes less than zero, so we get
>
> hashtable.c:292:
> approx_sqrt (double x)
> {
> double s, d;
>
> if (x < 0)
> abort ();
>
> BAMM.
>
> Below is a reduced patch to fix this problem:
>
> 2004-03-24 Serge Belyshev <1319@bot.ru>
>
> PR 14699
> * hashtable.c (ht_dump_statistics): Change type of sum_of_squares
> from size_t to double.
This is OK. A patch to make the formula for the standard deviation
more accurate is also OK, but please submit it separately from this
bugfix.
zw