Landing: f8c277ed801b

Project / Subsystem

gcc / libstdc++

Date

2026-07-09

Author

Tomasz Kamiński

Commit

f8c277ed801ba6310a3d6933e6fab7493f5bfcaf

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
libstdc++
patch_id
commit_hash
f8c277ed801ba6310a3d6933e6fab7493f5bfcaf
source_type
github
headline
libstdc++: Piecewise distributions now use result_type for generation.
tldr
Piecewise distributions in libstdc++ now generate values matching the template's result_type instead of always using double.
author
Tomasz Kamiński
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • libstdc++
  • random
  • numeric
discussion_id_link
bugzilla_pr
date
2026-07-09T00:00:00.000Z

This commit updates libstdc++‘s piecewise distributions to generate values consistent with their template parameter _RealType, rather than always defaulting to double. This change addresses issues with precision and LWG4052 regarding input type requirements. Internal computations now also use _RealType for better precision, though double is retained for storage to maintain ABI compatibility unless _GLIBCXX_USE_RESULT_TYPE_FOR_PIECEWISE_DENSITIES is defined. New helper functions __generate_one reduce code duplication.