The functions fmin and fmax are designed to work with floating point numbers (hence the "f").
Depending on your compiler/platform, you may experience performance or precision losses when using it for ints due to conversion, function call overhead, and other factors.
std::min and std::max are two standard variables.
are template functions (defined in the header) that work on any type that has a less-than () operator, allowing them to operate on any data type that allows a comparison.
If you don't want it to work off, you can create your own comparison function.
This is safer because when arguments have different types, you must explicitly convert them to match.
For example, the compiler will not allow you to convert a 64-bit int to a 64-bit float by mistake.
The templates should be made for this reason alone.
Even when used with floats, the template may outperform the others in terms of performance.
Because the source code is part of the compilation unit, a compiler can always inline calls to template functions.
On the other hand, in-lining a call to a library function isn't always possible (shared libraries, absence of link-time optimization, etc.).