[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug in binomial_tpe?
From: |
Dominic Steinitz |
Subject: |
Bug in binomial_tpe? |
Date: |
Thu, 6 Jun 2024 12:11:30 +0100 |
With
gcc -DDIRECT -c binomial_tpe.c -o binomial_tpe.o
-I/nix/store/5rdvp5g7yix9rsjqhp8mwsjgxxfzkygq-gsl-2.7.1-dev/include
I get
binomial_tpe.c:371:11: error: use of undeclared identifier 'var'
if (var <= accept)
^
binomial_tpe.c:371:18: error: use of undeclared identifier 'accept'
if (var <= accept)
^
binomial_tpe.c:139:22: error: use of undeclared label 'Finish'
goto Finish;
^
binomial_tpe.c:381:1: error: type specifier missing, defaults to 'int'; ISO C99
and later do not
support implicit int [-Wimplicit-int]
Finish:
^
int
binomial_tpe.c:381:7: error: expected ';' after top level declarator
Finish:
^
;
binomial_tpe.c:383:3: error: expected identifier or '('
return (flipped) ? (n - ix) : (unsigned int)ix;
^
binomial_tpe.c:384:1: error: extraneous closing brace ('}')
}
^
7 errors generated.
With this patch, compilation succeeds. Caveat: I haven’t tried chi-squared yet
and given it doesn’t compile it can’t have been tested.
diff --git a/randist/binomial_tpe.c b/randist/binomial_tpe.c
index d32423cc..e2dacf9f 100644
--- a/randist/binomial_tpe.c
+++ b/randist/binomial_tpe.c
@@ -319,6 +319,7 @@ gsl_ran_binomial (const gsl_rng * rng, double p, unsigned
int n)
if (var > ynorm + amaxp)
goto TryAgain;
}
+ }
/* Now, again: do the test log(v) vs. log f(x)/f(M) */
@@ -362,7 +363,6 @@ gsl_ran_binomial (const gsl_rng * rng, double p, unsigned
int n)
}
#endif
#endif
- }
if (var <= accept)
Dominic Steinitz
dominic@steinitz.org
http://idontgetoutmuch.org
Twitter: @idontgetoutmuch
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Bug in binomial_tpe?,
Dominic Steinitz <=