Rule M5-0-7 (required, implementation, automated)

There shall be no explicit floating-integral conversions of a cvalue expression. See MISRA C++ 2008 [7] Note: Standard library functions, i.e. std::floor and std::ceil, return a floating-point data type:

#include #include

void Fn() noexcept { float f = -4.5; std::int8_t x1 = static_caststd::int8_t(f); // Compliant, x1 = -4 std::int8_t x2 = static_caststd::int8_t(std::floor(f)); // Compliant, x2 = -5 std::int8_t x3 = static_caststd::int8_t(std::ceil(f)); // Compliant, x3 = -4 }