Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Core Modules
dune-common
Commits
2a3d475d
Commit
2a3d475d
authored
3 years ago
by
Ansgar Burchardt
Browse files
Options
Downloads
Patches
Plain Diff
rename `Mantissa` to `Base`
parent
5b3cf994
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1082
rename `Mantissa` to `Base`
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/common/math.hh
+5
-5
5 additions, 5 deletions
dune/common/math.hh
dune/common/power.hh
+5
-5
5 additions, 5 deletions
dune/common/power.hh
with
10 additions
and
10 deletions
dune/common/math.hh
+
5
−
5
View file @
2a3d475d
...
...
@@ -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
;
}
...
...
This diff is collapsed.
Click to expand it.
dune/common/power.hh
+
5
−
5
View file @
2a3d475d
...
...
@@ -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!
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment