New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Debian] DistFunc_binomial issues in tests on arm64 and ppc64el #2046
Comments
it's ok to fix it in ot |
I found out that this is due to the floating-point expression contraction optimization. |
The root cause is Table-maker's_dilemma, i.e. a "5" digit, followed by a long list of zeros. Hence, the result depends on the rounding of the last digit. This failure reveals that the unit tests should not use a comparison to a reference text file, and use assertions instead.
|
I've tried to understand the problem with
So I ran the following R script: options(digits=17)
print("dBinomial(11, 0.1, 9)=")
print(dbinom(x=9, size=11, prob=.1))
print("dBinomial(6, 0.5, 1)=")
print(dbinom(x=1, size=6, prob=.5))
print("dBinomial(6, 0.5, 5) = ")
print(dbinom(x=5, size=6, prob=.5)) Output:
|
we can do that, it's more involving than a self contained script because files have to be copied by cmake though |
Hello,
During the Debian packaging of version 1.18, I noticed the following test failure on the architectures arm64 and ppc64el :
343/492 Test #343: cppcheck_DistFunc_binomial .......................................***Failed 0.15 sec
--- /<>/lib/test/t_DistFunc_binomial.expout 2021-11-10 07:42:45.000000000 +0000
+++ /<>/build-python3.10/lib/test/t_DistFunc_binomial.out 2022-04-11 22:20:54.053398612 +0000
@@ -70,7 +70,7 @@
dBinomial(11, 0.1, 6)=0.000273
dBinomial(11, 0.1, 7)=2.17e-05
dBinomial(11, 0.1, 8)=1.2e-06
-dBinomial(11, 0.1, 9)=4.46e-08
+dBinomial(11, 0.1, 9)=4.45e-08
dBinomial(11, 0.1, 10)=9.9e-10
dBinomial(11, 0.1, 11)=1e-11
dBinomial(12, 0.1, 0)=0.282
@@ -193,11 +193,11 @@
dBinomial(5, 0.5, 4)=0.156
dBinomial(5, 0.5, 5)=0.0312
dBinomial(6, 0.5, 0)=0.0156
-dBinomial(6, 0.5, 1)=0.0938
+dBinomial(6, 0.5, 1)=0.0937
dBinomial(6, 0.5, 2)=0.234
dBinomial(6, 0.5, 3)=0.312
dBinomial(6, 0.5, 4)=0.234
-dBinomial(6, 0.5, 5)=0.0938
+dBinomial(6, 0.5, 5)=0.0937
dBinomial(6, 0.5, 6)=0.0156
dBinomial(7, 0.5, 0)=0.00781
dBinomial(7, 0.5, 1)=0.0547
I guess one only has to decrease the number of digits in the output to correct this issue. Maybe you would not like to do it, in which case I would make it a Debian-specific change.
Best,
Pierre
The text was updated successfully, but these errors were encountered: