I'm the KDE maintainer for the Adélie Linux distro, a newer distribution (based on Alpine) that uses the musl libc. While building analitza 17.12.2 for the 32-bit x86 architecture: ********* Start testing of CommandsTest ********* Config: Using QtTest library 5.9.3, Qt 5.9.3 (i386-little_endian-ilp32 shared (dynamic) release build; by GCC 6.4.0) PASS : CommandsTest::initTestCase() PASS : CommandsTest::testCorrect(simple range) PASS : CommandsTest::testCorrect(range(a,b)) FAIL! : CommandsTest::testCorrect(range(a,b)) Compared values are not the same Actual (last.toString()): "list { 0, 0.2, 0.4, 0.6, 0.8 }" Expected (result) : "list { 0, 0.2, 0.4, 0.6, 0.8, 1 }" Loc: [/usr/src/packages/user/analitza/src/analitza-17.12.2/analitza/tests/commandstest.cpp(422)] This is the only test that fails. Trying a simple C program: #include <stdio.h> int main(void) { for(double x = 0.0; x <= 1.0; x += 0.2) printf("%.02f\n", x); return 0; } does produce the intended result: 0.00 0.20 0.40 0.60 0.80 1.00 so it doesn't seem like the architecture itself is the problem. I will note that Analitza passes its test suite successfully on x86_64, 32-bit PowerPC, and 64-bit PowerPC. I'm not sure how else to help debug this failure.
Thank you very much for bringing up this issue The code that controls this is the loop in listcommands.cpp:73. Having a way to reproduce this would be interesting, it definitely looks like double being fussy. Maybe you can try applying this and tell me if it works? Another thing you could do is providing a docker image where I can test this. diff --git a/analitza/commands/listcommands.cpp b/analitza/commands/listcommands.cpp index b77f49a9..2885169a 100644 --- a/analitza/commands/listcommands.cpp +++ b/analitza/commands/listcommands.cpp @@ -69,8 +69,9 @@ Expression RangeCommand::operator()(const QList< Analitza::Expression >& args) Analitza::List *seq = new Analitza::List; - for (double x = a; x <= b; x += h) + for (double x = a; x < b || qFuzzyCompare(x, b); x += h) { seq->appendBranch(new Analitza::Cn(x)); + } ret.setTree(seq);
That patch fixes the test suite on 32-bit x86. Any 32-bit x86 Docker image of Alpine or Adélie should allow you to easily repro this.
Git commit 07dd33b04976dfa872ffa4c24bb17adc5803ee64 by Aleix Pol. Committed on 01/06/2018 at 12:41. Pushed by apol into branch 'master'. Fix comparison in some 32bit machines M +2 -1 analitza/commands/listcommands.cpp https://commits.kde.org/analitza/07dd33b04976dfa872ffa4c24bb17adc5803ee64