mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
fix median overflow bug
This commit is contained in:
parent
82149bfe44
commit
426dbf434b
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include "misc_language.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -86,7 +87,7 @@ Tpod Stats<T, Tpod>::get_median() const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
median = (sorted[(sorted.size() - 1) / 2] + sorted[sorted.size() / 2]) / 2;
|
median = epee::misc_utils::get_mid(sorted[(sorted.size() - 1) / 2], sorted[sorted.size() / 2]);
|
||||||
}
|
}
|
||||||
set_cached(bit_median);
|
set_cached(bit_median);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue