changeset 19506:36d1f379a4f0

Faddeeva.cc: Fix compilation warnings. Faddeeva.cc (FADDEEVA(Dawson)): Avoid shadowing variable 'x2'. Faddeeva.cc (erfcx_y100): Replace old-style cast operator with C++ static_cast. Faddeeva.cc (w_im_y100): Replace old-style cast operator with C++ static_cast.
author Kai T. Ohlhus <k.ohlhus@gmail.com>
date Mon, 10 Nov 2014 16:43:39 +0100
parents 9f8ec58b5c74
children 25f535b90e52
files liboctave/cruft/Faddeeva/Faddeeva.cc
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/cruft/Faddeeva/Faddeeva.cc
+++ b/liboctave/cruft/Faddeeva/Faddeeva.cc
@@ -565,8 +565,8 @@
  taylor_realaxis:
   {
     double x2 = x*x;
+    double y2 = y*y;
     if (x2 > 1600) { // |x| > 40
-      double y2 = y*y;
       if (x2 > 25e14) {// |x| > 5e7
         double xy2 = (x*y)*(x*y);
         return C((0.5 + y2 * (0.5 + 0.25*y2
@@ -584,7 +584,6 @@
     }
     else {
       double D = spi2 * FADDEEVA(w_im)(x);
-      double x2 = x*x, y2 = y*y;
       return C
         (D + y2 * (D + x - 2*D*x2)
          + y2*y2 * (D * (0.5 - x2 * (2 - 0.66666666666666666667*x2))
@@ -1010,7 +1009,7 @@
    compared to fitting the whole [0,1] interval with a single polynomial. */
 static double erfcx_y100(double y100)
 {
-  switch ((int) y100) {
+  switch (static_cast<int> (y100)) {
 case 0: {
 double t = 2*y100 - 1;
 return 0.70878032454106438663e-3 + (0.71234091047026302958e-3 + (0.35779077297597742384e-5 + (0.17403143962587937815e-7 + (0.81710660047307788845e-10 + (0.36885022360434957634e-12 + 0.15917038551111111111e-14 * t) * t) * t) * t) * t) * t;
@@ -1454,7 +1453,7 @@
    the Chebyshev polynomials to be of significantly lower degree (about 1/30)
    compared to fitting the whole [0,1] interval with a single polynomial. */
 static double w_im_y100(double y100, double x) {
-  switch ((int) y100) {
+  switch (static_cast<int> (y100)) {
     case 0: {
       double t = 2*y100 - 1;
       return 0.28351593328822191546e-2 + (0.28494783221378400759e-2 + (0.14427470563276734183e-4 + (0.10939723080231588129e-6 + (0.92474307943275042045e-9 + (0.89128907666450075245e-11 + 0.92974121935111111110e-13 * t) * t) * t) * t) * t) * t;