Skip to content

Commit

Permalink
Fix log1p for OSX 10.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Constellation committed Aug 27, 2012
1 parent 61996b1 commit ad0379d
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions iv/platform_math.h
Expand Up @@ -62,14 +62,6 @@ inline double Log2(double x) {
return std::log(x) / 0.693147180559945309417232121458176568;
}

inline double Log1p(double x) {
// log1p(n) = log(n + 1)
if (x == 0) {
return x;
}
return std::log(x + 1);
}

inline double Expm1(double x) {
// expm1(n) = exp(n) - 1
//
Expand Down Expand Up @@ -129,10 +121,6 @@ inline double Log2(double x) {
return std::log2(x);
}

inline double Log1p(double x) {
return std::log1p(x);
}

inline double Expm1(double x) {
return std::expm1(x);
}
Expand All @@ -151,6 +139,14 @@ inline double Atanh(double x) {

#endif

inline double Log1p(double x) {
// log1p(n) = log(n + 1)
if (x == 0) {
return x;
}
return std::log(x + 1);
}

inline double Round(double value) {
const double res = std::ceil(value);
if (value > 0) {
Expand Down

0 comments on commit ad0379d

Please sign in to comment.