Skip to content
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

Closed
pgrt opened this issue May 14, 2022 · 5 comments
Closed

[Debian] DistFunc_binomial issues in tests on arm64 and ppc64el #2046

pgrt opened this issue May 14, 2022 · 5 comments
Labels
Milestone

Comments

@pgrt
Copy link
Contributor

pgrt commented May 14, 2022

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

@jschueller
Copy link
Member

it's ok to fix it in ot

@jschueller
Copy link
Member

I found out that this is due to the floating-point expression contraction optimization.
One can work-around it by setting "-ffp-contract=off" in CXXFLAGS.
Not an incorrect result per say, but our reference is x86_64 where such optimizations are not available.

jschueller added a commit to jschueller/openturns that referenced this issue Nov 22, 2022
@jschueller jschueller mentioned this issue Nov 22, 2022
@jschueller jschueller added this to the 1.21 milestone Nov 22, 2022
jschueller added a commit to jschueller/openturns that referenced this issue Nov 24, 2022
jschueller added a commit to jschueller/openturns that referenced this issue Nov 24, 2022
jschueller added a commit to jschueller/openturns that referenced this issue Nov 24, 2022
jschueller added a commit to jschueller/openturns that referenced this issue Nov 24, 2022
jschueller added a commit to jschueller/openturns that referenced this issue Nov 28, 2022
jschueller added a commit to jschueller/openturns that referenced this issue Nov 29, 2022
jschueller added a commit to jschueller/openturns that referenced this issue Nov 30, 2022
jschueller added a commit to jschueller/openturns that referenced this issue Nov 30, 2022
@mbaudin47
Copy link
Collaborator

mbaudin47 commented Dec 5, 2022

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.
In Scilab, I used this method:

@josephmure
Copy link
Collaborator

I've tried to understand the problem with

-dBinomial(11, 0.1, 9)=4.46e-08
+dBinomial(11, 0.1, 9)=4.45e-08

-dBinomial(6, 0.5, 1)=0.0938
+dBinomial(6, 0.5, 1)=0.0937

-dBinomial(6, 0.5, 5)=0.0938
+dBinomial(6, 0.5, 5)=0.0937

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:

[1] "dBinomial(11, 0.1, 9)="
[1] 4.4550000000000038e-08
[1] "dBinomial(6, 0.5, 1)="
[1] 0.093749999999999986
[1] "dBinomial(6, 0.5, 5) = "
[1] 0.093750000000000028

@jschueller
Copy link
Member

we can do that, it's more involving than a self contained script because files have to be copied by cmake though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants