[PATCH] fix: use values that are representable as double in test
authorAnsgar Burchardt <ansgar.burchardt@tu-dresden.de>
Mon, 25 Dec 2023 22:40:36 +0000 (23:40 +0100)
committerAnsgar <ansgar@debian.org>
Tue, 26 Dec 2023 18:41:53 +0000 (19:41 +0100)
From f61fb0dbc9b41b2661a3b481a056fd006a238495 Mon Sep 17 00:00:00 2001
Origin: vendor, https://gitlab.dune-project.org/core/dune-common/-/merge_requests/1327

Values like 0.1 are not representable as a double which can result in
problems, for example:

```
[...]/dune/common/test/hybridutilitiestest.cc:114:43: error: static assertion failed: Wrong compile time sum!
  114 |   static_assert(sum(numberTupleConstexpr) == 5.1, "Wrong compile time sum!");
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
[...]/dune/common/test/hybridutilitiestest.cc:114:43: note: the comparison reduces to ‘(5.09999999999999964473e+0l == 5.09999999999999999991e+0l)’
```

with [gcc 13.2.0 on i386][1].

  [1]: https://buildd.debian.org/status/fetch.php?pkg=dune-common&arch=i386&ver=2.9.0-4&stamp=1703267709&raw=0

Gbp-Pq: Name 0001-fix-use-values-that-are-representable-as-double-in-t.patch

dune/common/test/hybridutilitiestest.cc

index 6ab00125794b24ec844029ea8fcb5e6f3d9ee291..d2f8763285197cd799a936efac45c913c8f1cdcb 100644 (file)
@@ -110,8 +110,8 @@ int main()
 
   // Compile time checks
   static_assert(sum(values) == (30*29)/2, "Wrong compile time sum!");
-  constexpr auto numberTupleConstexpr = Dune::makeTupleVector(0.1, 2, 3);
-  static_assert(sum(numberTupleConstexpr) == 5.1, "Wrong compile time sum!");
+  constexpr auto numberTupleConstexpr = Dune::makeTupleVector(0.25, 2, 3);
+  static_assert(sum(numberTupleConstexpr) == 5.25, "Wrong compile time sum!");
 
   return test.exit();
 }