Skip to content

Commit b9ca6fb

Browse files
authored
Merge pull request #624 from OpenVicProject/improve_fp_trunc_warning_check
Improve fp trunc warning check
2 parents b7dfae0 + d00c8a3 commit b9ca6fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/openvic-simulation/types/fixed_point/FixedPoint.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ namespace OpenVic {
191191
explicit constexpr operator T() const {
192192
#ifdef DEV_ENABLED
193193
if (!std::is_constant_evaluated()) {
194-
if (OV_unlikely(value < ONE)) {
194+
if (OV_unlikely(value != 0 && abs() < ONE)) {
195195
spdlog::warn_s(
196-
"Fixed point < 1, truncation will result in zero, this may be a bug. raw_value: {} as float: {}",
196+
"0 < abs(Fixed point) < 1, truncation will result in zero, this may be a bug. raw_value: {} as float: {}",
197197
get_raw_value(),
198198
static_cast<float>(*this)
199199
);

0 commit comments

Comments
 (0)