Vowpal Wabbit
vowpalwabbit
correctedMath.h
Go to the documentation of this file.
1
// On Windows, exp(-infinity) incorrectly returns -infinity instead of 0.
2
// So we replace it with our own version that checks for this condition.
3
4
#pragma once
5
6
#include <cmath>
7
#include <cmath>
8
9
#ifdef _WIN32
10
// this is a bug in VS2013, fixed in VS2015 runtime
11
template
<
typename
T>
12
T
correctedExp
(T exponent)
13
{
14
if
(isinf(exponent) && exponent < T(0))
15
{
16
return
T(0);
17
}
18
else
19
{
20
return
exp(exponent);
21
}
22
}
23
#else
24
// std::exp is used because on Linux, not using the namespace caused a different implementation of
25
// exp to be linked providing incorrect values when `#include <boost/program_options.hpp>` was
26
// removed in global_data.h
27
#define correctedExp std::exp
28
#endif
correctedExp
#define correctedExp
Definition:
correctedMath.h:27
Generated on Thu Apr 9 2020 14:45:24 for Vowpal Wabbit by
1.8.13