Summary
In this episode, Jason explores C++11's std::fmin function, which provides special handling for floating-point comparisons involving NaN (Not a Number) values. Unlike std::min, which returns NaN when it appears as a parameter, std::fmin treats NaN as a placeholder value and always returns the non-NaN value regardless of parameter order. Jason demonstrates this behavior and notes that std::fmin returns by value rather than by reference. He then extends his variadic min implementation from the previous episode to create a variadic version of fmin, allowing for convenient comparison of multiple floating-point values with proper NaN handling.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[alg.min.max]40% match -
[c.math]40% match -
[numeric.limits]40% match