[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master e164681 2/4: Remove a needless postcondition
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master e164681 2/4: Remove a needless postcondition |
Date: |
Mon, 19 Mar 2018 16:43:02 -0400 (EDT) |
branch: master
commit e164681981263c6bc058f995be5095f6da999941
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Remove a needless postcondition
Lifted a local ban on zettadollar values, which wasn't germane here.
Such a limit is already imposed by look_up_scale_unit().
Documented the remaining asserted postcondition as a part of this
function's contract.
---
miscellany.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/miscellany.cpp b/miscellany.cpp
index b4505aa..665c234 100644
--- a/miscellany.cpp
+++ b/miscellany.cpp
@@ -116,6 +116,8 @@ bool files_are_identical(std::string const& file0,
std::string const& file1)
/// Asserted preconditions:
/// 3 <= max_power
/// min_value <= max_value
+/// Asserted postcondition:
+/// return value is nonnegative
int scale_power(int max_power, double min_value, double max_value)
{
@@ -143,7 +145,6 @@ int scale_power(int max_power, double min_value, double
max_value)
int const r = 3 * (1 + (excess - 1) / 3);
LMI_ASSERT(0 <= r);
- LMI_ASSERT(r <= 18);
return r;
}