Source: cppformat Version: 1.1.0+ds-3 Severity: normal Tags: patch User: debian-powe...@lists.debian.org
Dear Maintainer, Although this package compiles on ppc64el, it fails in the test suite. Specifically, the format-test fails in FormatterTest.FormatLongDouble. This is what is in the log: Value of: format("{0:+010.4g}", 392.65l) Actual: "+0000392.7" Expected: "+0000392.6" >From printing the number as a float, with format specifier %.20LF, I could see that 392.65l in ppc64el is rounded from 392.65000000000000000000, while in x86_64 it is rounded from 392.64999999999999999445. I can't really explain the reason for the difference, so the patch I am attaching here just checks the architecture in precompilation and the test then expects the number rounded accordingly. Thanks & Regards Fernando -- System Information: Debian Release: 8.0 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'unstable'), (500, 'stable'), (1, 'experimental') Architecture: ppc64el (ppc64le) Kernel: Linux 3.16.0-4-powerpc64le (SMP w/8 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system)
--- cppformat-1.1.0+ds.orig/test/format-test.cc +++ cppformat-1.1.0+ds/test/format-test.cc @@ -1163,7 +1163,11 @@ TEST(FormatterTest, FormatLongDouble) { safe_sprintf(buffer, "%Le", 392.65l); EXPECT_EQ(buffer, format("{0:e}", 392.65l)); safe_sprintf(buffer, "%LE", 392.65l); +#ifdef __PPC__ + EXPECT_EQ("+0000392.7", format("{0:+010.4g}", 392.65l)); +#else EXPECT_EQ("+0000392.6", format("{0:+010.4g}", 392.65l)); +#endif } TEST(FormatterTest, FormatChar) {