projects
/
folly.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cdadb04
)
folly: ubsan: Benchmark: avoid division by zero (fsanitize=float-divide-by-zero)
author
Lucian Grijincu
<lucian@fb.com>
Mon, 1 Feb 2016 23:19:55 +0000
(15:19 -0800)
committer
facebook-github-bot-4
<folly-bot@fb.com>
Tue, 2 Feb 2016 00:20:27 +0000
(16:20 -0800)
Reviewed By: philippv
Differential Revision:
D2886132
fb-gh-sync-id:
a845d657fb920847df52fe5ec077e91554544f5b
folly/Benchmark.cpp
patch
|
blob
|
history
diff --git
a/folly/Benchmark.cpp
b/folly/Benchmark.cpp
index 627972ab132dc9968b5b45bab3b028455f6175bf..b1296aa74def106383af5d40c4de7892593e8c08 100644
(file)
--- a/
folly/Benchmark.cpp
+++ b/
folly/Benchmark.cpp
@@
-397,7
+397,9
@@
static void printBenchmarkResultsAsTable(
s.resize(columns - 29, ' ');
auto nsPerIter = get<2>(datum);
auto secPerIter = nsPerIter / 1E9;
- auto itersPerSec = 1 / secPerIter;
+ auto itersPerSec = (secPerIter == 0)
+ ? std::numeric_limits<double>::infinity()
+ : (1 / secPerIter);
if (!useBaseline) {
// Print without baseline
printf("%*s %9s %7s\n",