Skip to content

Commit a9eb2f2

Browse files
committed
libstdc++: Use -fexcess-precision=standard for std::generate_canonical tests
On 32-bit x86 the default -fexcess-precision=fast setting used by -std=gnu++20 results in unpredictable rounding which alters the number of times that std::generate_canonical produces exactly 1.0f, which means that the URBG is invoked a different number of times. To ensure that the behaviour is consistent and the expected number of calls happens, use -fexcess-precision=standard. libstdc++-v3/ChangeLog: * testsuite/26_numerics/random/uniform_real_distribution/operators/64351.cc: Add -fexcess-precision=standard to options. * testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc: Likewise. Reviewed-by: Jakub Jelinek <[email protected]>
1 parent 53893d4 commit a9eb2f2

File tree

2 files changed

+2
-0
lines changed
  • libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators

2 files changed

+2
-0
lines changed

libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/64351.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
// { dg-do run { target { c++11 && { ! simulator } } } }
1919
// { dg-require-cstdint "" }
20+
// { dg-additional-options -fexcess-precision=standard }
2021

2122
#include <random>
2223
#include <testsuite_hooks.h>

libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// { dg-do run { target { c++11 && { ! simulator } } } }
22
// { dg-skip-if "requires new impl" { *-*-* } { -D_GLIBCXX_USE_OLD_GENERATE_CANONICAL -D_GLIBCXX_USE_OLD_GENERATE_CANONICAL=1 } }
3+
// { dg-additional-options -fexcess-precision=standard }
34

45
#include <random>
56
#include <limits>

0 commit comments

Comments
 (0)