lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 2987bf0 2/4: Resolve more '-Wconversion' issu


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 2987bf0 2/4: Resolve more '-Wconversion' issues
Date: Thu, 31 May 2018 20:05:35 -0400 (EDT)

branch: master
commit 2987bf0d9602d2e6c8b0fc847cfaa749e59709b0
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Resolve more '-Wconversion' issues
---
 financial_test.cpp | 7 +++----
 workhorse.make     | 1 -
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/financial_test.cpp b/financial_test.cpp
index 1637a18..dd60c5e 100644
--- a/financial_test.cpp
+++ b/financial_test.cpp
@@ -97,11 +97,10 @@ int test_main(int, char*[])
     // For any stream, NPV at the IRR rate should ideally be zero.
     std::vector<double> q{p};
     q.push_back(-b.back());
-    double r = npv(q.begin(), q.end(), results.back());
     // This NPV is -9.777068044058979E-12 in a gnumeric spreadsheet,
     // versus -9.86988e-014 with MinGW-w64 gcc-6.3.0; the 1e-13
     // tolerance is simply the materially_equal() default.
-    BOOST_TEST(std::fabs(r) <= 1e-13);
+    BOOST_TEST(std::fabs(npv(q.begin(), q.end(), results.back())) <= 1e-13);
 
     // Trivially, NPV at 0% interest is summation.
     BOOST_TEST(materially_equal(-4950.0L, npv(q.begin(), q.end(), 0.0)));
@@ -188,8 +187,8 @@ int test_main(int, char*[])
 
     // Test fv().
 
-    static long double const i = .05L;
-    static double const one_plus_i = 1.0L + i;
+    static double const i = .05;
+    static double const one_plus_i = 1.0 + i;
     std::vector<double> accum_p(p.size());
     accum_p[0] = p[0] * one_plus_i;
     for(unsigned int j = 1; j < p.size(); ++j)
diff --git a/workhorse.make b/workhorse.make
index 4b54872..f9193d5 100644
--- a/workhorse.make
+++ b/workhorse.make
@@ -485,7 +485,6 @@ wno_conv_objects := \
 $(wno_conv_objects): gcc_common_extra_warnings += -Wno-conversion
 
 wno_float_conv_objects := \
-  financial_test.o \
   gpt_server.o \
   ihs_basicval.o \
   mec_server.o \



reply via email to

[Prev in Thread] Current Thread [Next in Thread]