From 87183a7534322d452dfca88e3e5e44986617c9e3 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Sun, 27 Jan 2013 19:50:49 -0500 Subject: [PATCH] replaced some std::log/exp calls by the math::fastlog/exp equivalent --- src/integrators/pssmlt/pssmlt_sampler.cpp | 2 +- src/libcore/warp.cpp | 2 +- src/rfilters/gaussian.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/integrators/pssmlt/pssmlt_sampler.cpp b/src/integrators/pssmlt/pssmlt_sampler.cpp index 2b4e8aad..98288e03 100644 --- a/src/integrators/pssmlt/pssmlt_sampler.cpp +++ b/src/integrators/pssmlt/pssmlt_sampler.cpp @@ -50,7 +50,7 @@ void PSSMLTSampler::serialize(Stream *stream, InstanceManager *manager) const { } void PSSMLTSampler::configure() { - m_logRatio = -std::log(m_s2/m_s1); + m_logRatio = -math::fastlog(m_s2/m_s1); m_time = 0; m_largeStepTime = 0; m_largeStep = false; diff --git a/src/libcore/warp.cpp b/src/libcore/warp.cpp index e10f766a..65872c3d 100644 --- a/src/libcore/warp.cpp +++ b/src/libcore/warp.cpp @@ -137,7 +137,7 @@ Point2 Warp::squareToStdNormal(const Point2 &sample) { } Float Warp::squareToStdNormalPdf(const Point2 &pos) { - return INV_TWOPI * std::exp(-(pos.x*pos.x + pos.y*pos.y)/2.0f); + return INV_TWOPI * math::fastexp(-(pos.x*pos.x + pos.y*pos.y)/2.0f); } static Float intervalToTent(Float sample) { diff --git a/src/rfilters/gaussian.cpp b/src/rfilters/gaussian.cpp index a9cc046b..5ec166aa 100644 --- a/src/rfilters/gaussian.cpp +++ b/src/rfilters/gaussian.cpp @@ -52,8 +52,8 @@ public: Float eval(Float x) const { Float alpha = -1.0f / (2.0f * m_stddev*m_stddev); return std::max((Float) 0.0f, - std::exp(alpha * x * x) - - std::exp(alpha * m_radius * m_radius)); + math::fastexp(alpha * x * x) - + math::fastexp(alpha * m_radius * m_radius)); } std::string toString() const {