[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] valyuta/002 4a6bc6c 02/14: Resolve confusion
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] valyuta/002 4a6bc6c 02/14: Resolve confusion |
Date: |
Thu, 17 Sep 2020 16:27:14 -0400 (EDT) |
branch: valyuta/002
commit 4a6bc6c3c6aa1059861cdcde7a73a743f5d99131
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Resolve confusion
Perhaps the comment isn't strictly true:
std::max(X, -std::numeric_limits<double>::max())
is intended to equal X, but that may not hold for exotic IEEE754 values.
It seems that is should be true for denormals, but not for negative
infinity; and it can't be true for NaN. Such matters need not be fretted
over on this experimental branch today.
---
ihs_acctval.cpp | 13 ++++++-------
ihs_avmly.cpp | 13 ++++++-------
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index fc92a37..e4c48e7 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -611,13 +611,12 @@ void AccountValue::SetInitialValues()
DcvWpCharge = 0.0;
HoneymoonActive = false;
- // -2147483647 is
- // -std::numeric_limits<int>::max())
- // The apparent intention was to choose an implausibly large
- // negative number that can be negated without the sort of
- // surprising result seen with INT_MIN, which is -2147483648.
- // Why that intention makes sense is another matter.
- HoneymoonValue = currency(-9223372036854775807);
+ // In 'master', this is
+ // -std::numeric_limits<double>::max()
+ // which is the identity element for std::max(). Here, it's nearly
+ // the equivalent for currency::data_type; dividing it by 101 is a
+ // casual defense against commuting between dollars and cents.
+ HoneymoonValue = currency(-std::numeric_limits<currency::data_type>::max()
/ 101, true);
if(mce_gen_curr == GenBasis_)
{
HoneymoonActive = yare_input_.HoneymoonEndorsement;
diff --git a/ihs_avmly.cpp b/ihs_avmly.cpp
index fe8c0c5..f0860b7 100644
--- a/ihs_avmly.cpp
+++ b/ihs_avmly.cpp
@@ -2057,13 +2057,12 @@ void AccountValue::TxTestHoneymoonForExpiration()
if(HoneymoonValue <= currency() || HoneymoonValue < csv_ignoring_loan)
{
HoneymoonActive = false;
- // -2147483647 is
- // -std::numeric_limits<int>::max())
- // The apparent intention was to choose an implausibly large
- // negative number that can be negated without the sort of
- // surprising result seen with INT_MIN, which is -2147483648.
- // Why that intention makes sense is another matter.
- HoneymoonValue = currency(-9223372036854775807);
+ // In 'master', this is
+ // -std::numeric_limits<double>::max()
+ // which is the identity element for std::max(). Here, it's nearly
+ // the equivalent for currency::data_type; dividing it by 101 is a
+ // casual defense against commuting between dollars and cents.
+ HoneymoonValue =
currency(-std::numeric_limits<currency::data_type>::max() / 101, true);
}
}
- [lmi-commits] [lmi] valyuta/002 updated (9433c8e -> 3f71218), Greg Chicares, 2020/09/17
- [lmi-commits] [lmi] valyuta/002 53de040 01/14: Add an extra argument to currency(data_type), Greg Chicares, 2020/09/17
- [lmi-commits] [lmi] valyuta/002 c5e0b01 04/14: Make currency class mandatory, Greg Chicares, 2020/09/17
- [lmi-commits] [lmi] valyuta/002 c80d1eb 09/14: Add two experimental options, Greg Chicares, 2020/09/17
- [lmi-commits] [lmi] valyuta/002 e4cb0f1 10/14: Make it float, Greg Chicares, 2020/09/17
- [lmi-commits] [lmi] valyuta/002 cfe336c 11/14: Make it faster, Greg Chicares, 2020/09/17
- [lmi-commits] [lmi] valyuta/002 4a6bc6c 02/14: Resolve confusion,
Greg Chicares <=
- [lmi-commits] [lmi] valyuta/002 0d47d8d 03/14: Refine an assertion, Greg Chicares, 2020/09/17
- [lmi-commits] [lmi] valyuta/002 27c198e 05/14: fixup, Greg Chicares, 2020/09/17
- [lmi-commits] [lmi] valyuta/002 3d1ff11 06/14: Remove useless casts, Greg Chicares, 2020/09/17
- [lmi-commits] [lmi] valyuta/002 594bd68 07/14: Allow floating currency::data_type, Greg Chicares, 2020/09/17
- [lmi-commits] [lmi] valyuta/002 1fbef51 13/14: Make it even faster, Greg Chicares, 2020/09/17
- [lmi-commits] [lmi] valyuta/002 420fac7 08/14: Allow currency to be dollars rather than cents, Greg Chicares, 2020/09/17
- [lmi-commits] [lmi] valyuta/002 3f71218 14/14: Trivially avoid spurious regression errors, Greg Chicares, 2020/09/17
- [lmi-commits] [lmi] valyuta/002 e262406 12/14: Make it more faster, Greg Chicares, 2020/09/17