Commit cd2f5874 authored by Jerome Benoit's avatar Jerome Benoit

RC #793998 - tests/distribution_tests - fix

parent b9c1badc
......@@ -2,7 +2,9 @@ apophenia (0.999e+ds-3) UNRELEASED; urgency=medium
* RC bug fix release (Closes: #793998):
- eg/test_updating FAILURE on some architectures: intricate type conversion
in apop_mcmc.c, unfold.
in apop_mcmc.c, unfold;
- tests/distribution_tests FAILURE on some 32bit architectures: double
comparison issue, fix via a numerical approach (based on GSL_DBL_EPSILN).
-- Jerome Benoit <calculus@rezozer.net> Sat, 29 Aug 2015 01:56:36 +0000
......
upstream-bug-793998-eg_test_updating.patch
upstream-bug-793998-tests_distribution_tests.patch
debianization.patch
debianization-help2man.patch
debianization-documentation.patch
......
Description: upstream -- RC bug fix 793998 -- tests/distribution_tests
Fix a machine precision issue by relying on a more numerical approach,
given that the employed numerical library is GSL.
It appears that on i386 architecture (at least) the last digits are chopped:
1-(*out) = 0x1p-63 verifies the test !(*out >= 1) inside the beta_rng function,
but inside the calling function (1-(*out)) is 0x0p+0 , that is *out is 1 .
(Note that GSL_DBL_EPSILON has the value 0x1p-52 .) The patch was designed with
'gcc (Debian 5.2.1-15) 5.2.1 20150808' on a i386 Debian porter (sid).
A more architecture oriented approach might exist, but anyway the numerical
approach is satisfactory given that advanced numerical computations are done
via GSL which relies on GSL_DBL_EPSILON.
Origin: debian
Author: Jerome Benoit <calculus@rezozer.net>
Last-Update: 2015-08-30
--- a/model/apop_beta.c
+++ b/model/apop_beta.c
@@ -88,11 +88,13 @@
}
static int beta_rng(double *out, gsl_rng *r, apop_model* eps){
+ double ans = GSL_NAN;
Nullcheck_mp(eps, 1)
Get_ab(eps)
do {
- *out = gsl_ran_beta(r, ab.alpha, ab.beta);
- } while (*out <= 0 || *out >= 1);
+ ans = gsl_ran_beta(r, ab.alpha, ab.beta);
+ } while (!((0.0 < ans) && (GSL_DBL_EPSILON <= 1.0 - ans)));
+ *out = ans;
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment