GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
libstdc++

libstdc++: Use 2*epsilon step for piecewise_constant_distribution tests.

Adjusted `piecewise_constant_distribution` tests in libstdc++ to use a 2*epsilon step.

The libstdc++ testsuite for piecewise_constant_distribution now uses a step size of 2 * epsilon() instead of a smaller value. This change ensures test consistency across different architectures, specifically resolving issues on powerpc64le-unknown-linux-gnu where floating-point precision differences previously caused failures.

In Details

In libstdc++, the piecewise_constant_distribution tests now use a step value of 2 * epsilon(). This adjustment aligns the test behavior with that of piecewise_linear_distribution and addresses precision-related test failures observed on specific architectures like powerpc64le-unknown-linux-gnu, ensuring reliable random number generation testing.

For Context
libstdc++
The C++ standard library implementation used by GCC. It provides classes and functions for I/O, strings, containers, algorithms, and more.
piecewise_constant_distribution
A random number distribution class that generates random numbers according to a piecewise constant probability density function.
epsilon
In floating-point arithmetic, epsilon refers to the smallest number such that 1.0 + epsilon != 1.0. It represents the machine epsilon, a measure of the machine's precision.
powerpc64le-unknown-linux-gnu
A specific target architecture triplet indicating a 64-bit PowerPC processor running Linux with the GNU toolchain.
Filed Under: libstdc++testsuiterandomfloating-point