Skip to content

Commit

Permalink
Modernize math constant
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau committed Oct 26, 2024
1 parent 9b1c04f commit 77aa4f0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/splines/cosine_evaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#pragma once

#include <cmath>

#include <ddc/ddc.hpp>
#include <ddc/kernels/splines.hpp>

#include <Kokkos_MathematicalConstants.hpp>

struct CosineEvaluator
{
template <class DDim>
Expand All @@ -18,7 +18,9 @@ struct CosineEvaluator
using Dim = DDim;

private:
static constexpr double s_2_pi = 2. * M_PI;
static constexpr double s_2_pi = 2 * Kokkos::numbers::pi;

static constexpr double s_pi_2 = Kokkos::numbers::pi / 2;

private:
double m_c0;
Expand Down Expand Up @@ -74,7 +76,7 @@ struct CosineEvaluator
KOKKOS_FUNCTION double eval(double const x, int const derivative) const noexcept
{
return ddc::detail::ipow(s_2_pi * m_c0, derivative)
* Kokkos::cos(M_PI_2 * derivative + s_2_pi * (m_c0 * x + m_c1));
* Kokkos::cos(s_pi_2 * derivative + s_2_pi * (m_c0 * x + m_c1));
}
};
};

0 comments on commit 77aa4f0

Please sign in to comment.