From 8055b8d19aa97d04ea739c2feae992479ace9cf1 Mon Sep 17 00:00:00 2001 From: ncoder-1 <7622286+ncoder-1@users.noreply.github.com> Date: Wed, 22 Apr 2020 11:37:58 +0000 Subject: [PATCH] Update dnn_introduction_ex.cpp (#2066) Changed C-style cast to static_cast. --- examples/dnn_introduction_ex.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/dnn_introduction_ex.cpp b/examples/dnn_introduction_ex.cpp index 6ae3ddf73..556da28ff 100644 --- a/examples/dnn_introduction_ex.cpp +++ b/examples/dnn_introduction_ex.cpp @@ -138,7 +138,7 @@ int main(int argc, char** argv) try } cout << "training num_right: " << num_right << endl; cout << "training num_wrong: " << num_wrong << endl; - cout << "training accuracy: " << num_right/(double)(num_right+num_wrong) << endl; + cout << "training accuracy: " << num_right / static_cast(num_right + num_wrong) << endl; // Let's also see if the network can correctly classify the testing images. Since // MNIST is an easy dataset, we should see at least 99% accuracy. @@ -155,7 +155,7 @@ int main(int argc, char** argv) try } cout << "testing num_right: " << num_right << endl; cout << "testing num_wrong: " << num_wrong << endl; - cout << "testing accuracy: " << num_right/(double)(num_right+num_wrong) << endl; + cout << "testing accuracy: " << num_right / static_cast(num_right + num_wrong) << endl; // Finally, you can also save network parameters to XML files if you want to do @@ -167,4 +167,3 @@ catch(std::exception& e) { cout << e.what() << endl; } -