Skip to content
Snippets Groups Projects
Commit 2a3d475d authored by Ansgar Burchardt's avatar Ansgar Burchardt
Browse files

rename `Mantissa` to `Base`

parent 5b3cf994
No related branches found
No related tags found
1 merge request!1082rename `Mantissa` to `Base`
......@@ -67,20 +67,20 @@ namespace Dune
/** \brief Power method for integer exponents
*
* \note Make sure that Mantissa is a non-integer type when using negative exponents!
* \note Make sure that Base is a non-integer type when using negative exponents!
*/
template <class Mantissa, class Exponent>
constexpr Mantissa power(Mantissa m, Exponent p)
template <class Base, class Exponent>
constexpr Base power(Base m, Exponent p)
{
static_assert(std::numeric_limits<Exponent>::is_integer, "Exponent must be an integer type!");
auto result = Mantissa(1);
auto result = Base(1);
auto absp = (p<0) ? -p : p; // This is simply abs, but std::abs is not constexpr
for (Exponent i = Exponent(0); i<absp; i++)
result *= m;
if (p<0)
result = Mantissa(1)/result;
result = Base(1)/result;
return result;
}
......
......@@ -16,18 +16,18 @@ namespace Dune {
@{
*/
/** \brief Calculates m^p at compile time
/** \brief Calculates b^p at compile time
* \deprecated Please use the method `power` from `math.hh` instead!
*/
template <int m, int p>
template <int b, int p>
struct StaticPower
{
/** \brief power stores m^p */
static constexpr int power = Dune::power(m,p);
/** \brief power stores b^p */
static constexpr int power = Dune::power(b,p);
};
/** \brief Compute power for a run-time mantissa and a compile-time integer exponent
/** \brief Compute power for a run-time base and a compile-time integer exponent
*
* \deprecated Please use the method `power` from `math.hh` instead!
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment