Fix clang tidy (#6463)

* Fix clang tidy

* Add exponent overflow test
This commit is contained in:
Olek
2026-03-04 11:30:33 -05:00
committed by GitHub
parent bc5ec3c962
commit 5afe8cc321
2 changed files with 17 additions and 0 deletions

View File

@@ -2252,6 +2252,12 @@ struct HostFuncImpl_test : public beast::unit_test::suite
auto const result = hfs.floatSet(10, -1, 0);
BEAST_EXPECT(result) && BEAST_EXPECT(*result == float1);
}
{
auto const result = hfs.floatSet(1, Number::maxExponent + normalExp + 1, 0);
BEAST_EXPECT(!result) &&
BEAST_EXPECT(result.error() == HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
}
void

View File

@@ -221,6 +221,7 @@ floatFromIntImpl(int64_t x, int32_t mode)
// LCOV_EXCL_START
catch (...)
{
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
// LCOV_EXCL_STOP
@@ -242,6 +243,7 @@ floatFromUintImpl(uint64_t x, int32_t mode)
// LCOV_EXCL_START
catch (...)
{
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
// LCOV_EXCL_STOP
@@ -262,6 +264,7 @@ floatSetImpl(int64_t mantissa, int32_t exponent, int32_t mode)
}
catch (...)
{
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
@@ -284,6 +287,7 @@ floatCompareImpl(Slice const& x, Slice const& y)
// LCOV_EXCL_START
catch (...)
{
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
// LCOV_EXCL_STOP
@@ -311,6 +315,7 @@ floatAddImpl(Slice const& x, Slice const& y, int32_t mode)
// LCOV_EXCL_START
catch (...)
{
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
// LCOV_EXCL_STOP
@@ -337,6 +342,7 @@ floatSubtractImpl(Slice const& x, Slice const& y, int32_t mode)
// LCOV_EXCL_START
catch (...)
{
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
// LCOV_EXCL_STOP
@@ -363,6 +369,7 @@ floatMultiplyImpl(Slice const& x, Slice const& y, int32_t mode)
// LCOV_EXCL_START
catch (...)
{
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
// LCOV_EXCL_STOP
@@ -388,6 +395,7 @@ floatDivideImpl(Slice const& x, Slice const& y, int32_t mode)
}
catch (...)
{
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
@@ -415,6 +423,7 @@ floatRootImpl(Slice const& x, int32_t n, int32_t mode)
// LCOV_EXCL_START
catch (...)
{
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
// LCOV_EXCL_STOP
@@ -445,6 +454,7 @@ floatPowerImpl(Slice const& x, int32_t n, int32_t mode)
// LCOV_EXCL_START
catch (...)
{
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
// LCOV_EXCL_STOP
@@ -470,6 +480,7 @@ floatLogImpl(Slice const& x, int32_t mode)
// LCOV_EXCL_START
catch (...)
{
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
}
return Unexpected(HostFunctionError::FLOAT_COMPUTATION_ERROR);
// LCOV_EXCL_STOP