С++. Как проверить входит ли число в диапазон
Как узнать, будет ли число входить в допустимый диапазон для типа float после умножения в строке
Result[i][j] += FirstValues[i][k] * SecondValues[k][j];
float **Matrix::Multiple(float **FirstValues, float **SecondValues, int FirstCol, int FirstRow, int SecondCol, int SecondRow)
{
float **Result;
Result = new float *[FirstCol];
for (int i = 0; i < SecondRow; ++i)
{
Result[i] = new float[SecondRow];
}
for (int i = 0; i < FirstRow; ++i)
for (int j = 0; j < SecondCol; ++j)
{
Result[i][j] = 0;
for (int k = 0; k < FirstCol; ++k)
{
Result[i][j] += FirstValues[i][k] * SecondValues[k][j];
}
}
return Result;
}
Источник: Stack Overflow на русском