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
Merge requests
!1082
rename `Mantissa` to `Base`
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
rename `Mantissa` to `Base`
ansgar/dune-common:rename-mantissa-to-base
into
master
Overview
0
Commits
1
Pipelines
1
Changes
2
Merged
Ansgar Burchardt
requested to merge
ansgar/dune-common:rename-mantissa-to-base
into
master
3 years ago
Overview
0
Commits
1
Pipelines
1
Changes
2
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
2a3d475d
1 commit,
3 years ago
2 files
+
10
−
10
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
dune/common/math.hh
+
5
−
5
Options
@@ -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
;
}
Loading