From c090b04045a0e080ed9bbab08581d5a1b6c21acc Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 2 May 2016 19:20:16 +0000 Subject: [PATCH] Initialize local doubles to NaN. Patch from STL@microsoft.com llvm-svn: 268285 --- .../rand.dist.samp.plinear/eval.pass.cpp | 49 +++++++++++----------- .../rand.dist.samp.plinear/eval_param.pass.cpp | 9 ++-- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp index 9606f96..6b0af42 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp @@ -24,6 +24,7 @@ #include #include #include +#include template inline @@ -60,10 +61,10 @@ int main() } std::sort(u.begin(), u.end()); int kp = -1; - double a; - double m; - double bk; - double c; + double a = std::numeric_limits::quiet_NaN(); + double m = std::numeric_limits::quiet_NaN(); + double bk = std::numeric_limits::quiet_NaN(); + double c = std::numeric_limits::quiet_NaN(); std::vector areas(Np); double S = 0; for (int i = 0; i < areas.size(); ++i) @@ -110,10 +111,10 @@ int main() } std::sort(u.begin(), u.end()); int kp = -1; - double a; - double m; - double bk; - double c; + double a = std::numeric_limits::quiet_NaN(); + double m = std::numeric_limits::quiet_NaN(); + double bk = std::numeric_limits::quiet_NaN(); + double c = std::numeric_limits::quiet_NaN(); std::vector areas(Np); double S = 0; for (int i = 0; i < areas.size(); ++i) @@ -160,10 +161,10 @@ int main() } std::sort(u.begin(), u.end()); int kp = -1; - double a; - double m; - double bk; - double c; + double a = std::numeric_limits::quiet_NaN(); + double m = std::numeric_limits::quiet_NaN(); + double bk = std::numeric_limits::quiet_NaN(); + double c = std::numeric_limits::quiet_NaN(); std::vector areas(Np); double S = 0; for (int i = 0; i < areas.size(); ++i) @@ -210,10 +211,10 @@ int main() } std::sort(u.begin(), u.end()); int kp = -1; - double a; - double m; - double bk; - double c; + double a = std::numeric_limits::quiet_NaN(); + double m = std::numeric_limits::quiet_NaN(); + double bk = std::numeric_limits::quiet_NaN(); + double c = std::numeric_limits::quiet_NaN(); std::vector areas(Np); double S = 0; for (int i = 0; i < areas.size(); ++i) @@ -260,10 +261,10 @@ int main() } std::sort(u.begin(), u.end()); int kp = -1; - double a; - double m; - double bk; - double c; + double a = std::numeric_limits::quiet_NaN(); + double m = std::numeric_limits::quiet_NaN(); + double bk = std::numeric_limits::quiet_NaN(); + double c = std::numeric_limits::quiet_NaN(); std::vector areas(Np); double S = 0; for (int i = 0; i < areas.size(); ++i) @@ -310,10 +311,10 @@ int main() } std::sort(u.begin(), u.end()); int kp = -1; - double a; - double m; - double bk; - double c; + double a = std::numeric_limits::quiet_NaN(); + double m = std::numeric_limits::quiet_NaN(); + double bk = std::numeric_limits::quiet_NaN(); + double c = std::numeric_limits::quiet_NaN(); std::vector areas(Np); double S = 0; for (int i = 0; i < areas.size(); ++i) diff --git a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp index 0f23ca2..8054a69 100644 --- a/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp @@ -22,6 +22,7 @@ #include #include // for sort #include +#include template inline @@ -59,10 +60,10 @@ int main() } std::sort(u.begin(), u.end()); int kp = -1; - double a; - double m; - double bk; - double c; + double a = std::numeric_limits::quiet_NaN(); + double m = std::numeric_limits::quiet_NaN(); + double bk = std::numeric_limits::quiet_NaN(); + double c = std::numeric_limits::quiet_NaN(); std::vector areas(Np); double S = 0; for (int i = 0; i < areas.size(); ++i) -- 2.7.4