mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 03:45:43 +00:00
chore(Core/Misc): update floor and ceil to std (#19837)
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "Log.h"
|
||||
#include "Timer.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <iterator>
|
||||
|
||||
// create instance
|
||||
@@ -87,12 +88,12 @@ uint32 UpdateTime::GetPercentile(uint8 p)
|
||||
double index = (double(p) / 100.0) * (GetDatasetSize() - 1);
|
||||
|
||||
// If the index is an integer, return the value at that index
|
||||
if (index == floor(index))
|
||||
if (index == std::floor(index))
|
||||
return _orderedUpdateTimeDataTable[index];
|
||||
|
||||
// Otherwise, perform linear interpolation
|
||||
int lowerIndex = floor(index);
|
||||
int upperIndex = ceil(index);
|
||||
int lowerIndex = std::floor(index);
|
||||
int upperIndex = std::ceil(index);
|
||||
double fraction = index - lowerIndex;
|
||||
|
||||
return _orderedUpdateTimeDataTable[lowerIndex] * (1 - fraction) + _orderedUpdateTimeDataTable[upperIndex] * fraction;
|
||||
|
||||
Reference in New Issue
Block a user