From: Marco Costalba Date: Mon, 30 Jul 2012 07:44:54 +0000 (+0200) Subject: Guard against 'divide by zero' in bench X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=90ec4a403ae326b85dfa68afd5fd7ed47d5bc651 Guard against 'divide by zero' in bench Also remove an useless cast. No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/benchmark.cpp b/src/benchmark.cpp index b0b9e16b..5800a37b 100644 --- a/src/benchmark.cpp +++ b/src/benchmark.cpp @@ -132,10 +132,10 @@ void benchmark(const Position& current, istream& is) { } } - int e = time.elapsed(); + int e = time.elapsed() + 1; // Assure positive to avoid a 'divide by zero' cerr << "\n===========================" << "\nTotal time (ms) : " << e << "\nNodes searched : " << nodes - << "\nNodes/second : " << int(nodes / (e / 1000.0)) << endl; + << "\nNodes/second : " << 1000 * nodes / e << endl; }