projects
/
fairystockfish.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
b61ec33
)
Guard against 'divide by zero' in bench
author
Marco Costalba
<mcostalba@gmail.com>
Mon, 30 Jul 2012 07:44:54 +0000 (09:44 +0200)
committer
Marco Costalba
<mcostalba@gmail.com>
Mon, 30 Jul 2012 17:05:15 +0000 (18:05 +0100)
Also remove an useless cast.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/benchmark.cpp
patch
|
blob
|
history
diff --git
a/src/benchmark.cpp
b/src/benchmark.cpp
index
b0b9e16
..
5800a37
100644
(file)
--- 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;
}