Use std::numeric_limits instead of float.h

git-svn-id: https://svn.eduke32.com/eduke32@7799 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-07-16 09:35:09 +00:00 committed by Christoph Oelckers
parent 5f1ec28913
commit d1b43acc06
3 changed files with 7 additions and 4 deletions

View file

@ -417,7 +417,9 @@ defined __x86_64__ || defined __amd64__ || defined _M_X64 || defined _M_IA64 ||
#include <stdlib.h>
#include <string.h>
#if !(defined _WIN32 && defined __clang__)
#include <float.h>
#endif
#include <math.h>
#include <ctype.h>
@ -427,6 +429,7 @@ defined __x86_64__ || defined __amd64__ || defined _M_X64 || defined _M_IA64 ||
#include <assert.h>
#ifdef __cplusplus
# include <limits>
# if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800)
# include <algorithm>
# include <functional>

View file

@ -2004,10 +2004,10 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
if (tspr->extra&TSPR_EXTRA_MDHACK)
{
#ifdef __arm__ // GL ES has a glDepthRangef and the loss of precision is OK there
float f = (float) (tspr->owner + 1) * (FLT_EPSILON * 8.0);
float f = (float) (tspr->owner + 1) * (std::numeric_limits<float>::epsilon() * 8.0);
if (f != 0.0) f *= 1.f/(float) (sepldist(globalposx - tspr->x, globalposy - tspr->y)>>5);
#else
double f = (double) (tspr->owner + 1) * (FLT_EPSILON * 8.0);
double f = (double) (tspr->owner + 1) * (std::numeric_limits<double>::epsilon() * 8.0);
if (f != 0.0) f *= 1.0/(double) (sepldist(globalposx - tspr->x, globalposy - tspr->y)>>5);
// glBlendFunc(GL_SRC_ALPHA, GL_DST_COLOR);
#endif

View file

@ -788,8 +788,8 @@ static void G_PrintFPS(void)
static int32_t frameCount;
static double cumulativeFrameDelay;
static double lastFrameTime;
static float lastFPS, minFPS = FLT_MAX, maxFPS;
static double minGameUpdate = DBL_MAX, maxGameUpdate;
static float lastFPS, minFPS = std::numeric_limits<float>::max(), maxFPS;
static double minGameUpdate = std::numeric_limits<double>::max(), maxGameUpdate;
double frameTime = timerGetHiTicks();
double frameDelay = frameTime - lastFrameTime;