Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Julien Cabieces
otb
Commits
0599fb69
Commit
0599fb69
authored
6 years ago
by
Manuel Grizonnet
Browse files
Options
Downloads
Patches
Plain Diff
ENH: declare constants in otbMath.h as constexpr
parent
664de77c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/Core/Common/include/otbMath.h
+39
-39
39 additions, 39 deletions
Modules/Core/Common/include/otbMath.h
with
39 additions
and
39 deletions
Modules/Core/Common/include/otbMath.h
+
39
−
39
View file @
0599fb69
...
...
@@ -40,54 +40,54 @@ namespace otb {
/** Define constants if not define in the "cmath" */
/* Some useful constants. */
const
double
CONST_E
=
2.7182818284590452354
;
/* e */
const
double
CONST_LOG2E
=
1.4426950408889634074
;
/* log_2 e */
const
double
CONST_LOG10E
=
0.43429448190325182765
;
/* log_10 e */
const
double
CONST_LN2
=
0.69314718055994530942
;
/* log_e 2 */
const
double
CONST_LN10
=
2.30258509299404568402
;
/* log_e 10 */
const
double
CONST_PI
=
3.14159265358979323846
;
/* pi */
const
double
CONST_PI_2
=
1.57079632679489661923
;
/* pi/2 */
const
double
CONST_PI_4
=
0.78539816339744830962
;
/* pi/4 */
const
double
CONST_PI_8
=
0.39269908169872415481
;
/* pi/8 */
const
double
CONST_1_PI
=
0.31830988618379067154
;
/* 1/pi */
const
double
CONST_2_PI
=
0.63661977236758134308
;
/* 2/pi */
const
double
CONST_2PI
=
6.28318530717958647693
;
/* 2*pi */
const
double
CONST_PI_180
=
0.01745329251994329577
;
/* pi/180 */
const
double
CONST_180_PI
=
57.2957795130823208768
;
/* 180/pi */
const
double
CONST_LNPI
=
std
::
log
(
CONST_PI
);
/* ln(pi)*/
const
double
CONST_SQRTPI
=
std
::
sqrt
(
CONST_PI
);
/* sqrt(pi)*/
const
double
CONST_2_SQRTPI
=
1.12837916709551257390
;
/* 2/sqrt(pi) */
const
double
CONST_SQRT2
=
1.41421356237309504880
;
/* sqrt(2) */
const
double
CONST_SQRT1_2
=
0.70710678118654752440
;
/* 1/sqrt(2) */
const
double
CONST_SQRT3
=
1.73205080756887729353
;
/* sqrt(3) */
const
double
CONST_EULER
=
0.57721566490153286060
;
/* euler constant*/
const
expr
double
CONST_E
=
2.7182818284590452354
;
/* e */
const
expr
double
CONST_LOG2E
=
1.4426950408889634074
;
/* log_2 e */
const
expr
double
CONST_LOG10E
=
0.43429448190325182765
;
/* log_10 e */
const
expr
double
CONST_LN2
=
0.69314718055994530942
;
/* log_e 2 */
const
expr
double
CONST_LN10
=
2.30258509299404568402
;
/* log_e 10 */
const
expr
double
CONST_PI
=
3.14159265358979323846
;
/* pi */
const
expr
double
CONST_PI_2
=
1.57079632679489661923
;
/* pi/2 */
const
expr
double
CONST_PI_4
=
0.78539816339744830962
;
/* pi/4 */
const
expr
double
CONST_PI_8
=
0.39269908169872415481
;
/* pi/8 */
const
expr
double
CONST_1_PI
=
0.31830988618379067154
;
/* 1/pi */
const
expr
double
CONST_2_PI
=
0.63661977236758134308
;
/* 2/pi */
const
expr
double
CONST_2PI
=
6.28318530717958647693
;
/* 2*pi */
const
expr
double
CONST_PI_180
=
0.01745329251994329577
;
/* pi/180 */
const
expr
double
CONST_180_PI
=
57.2957795130823208768
;
/* 180/pi */
const
expr
double
CONST_LNPI
=
std
::
log
(
CONST_PI
);
/* ln(pi)*/
const
expr
double
CONST_SQRTPI
=
std
::
sqrt
(
CONST_PI
);
/* sqrt(pi)*/
const
expr
double
CONST_2_SQRTPI
=
1.12837916709551257390
;
/* 2/sqrt(pi) */
const
expr
double
CONST_SQRT2
=
1.41421356237309504880
;
/* sqrt(2) */
const
expr
double
CONST_SQRT1_2
=
0.70710678118654752440
;
/* 1/sqrt(2) */
const
expr
double
CONST_SQRT3
=
1.73205080756887729353
;
/* sqrt(3) */
const
expr
double
CONST_EULER
=
0.57721566490153286060
;
/* euler constant*/
/* The above constants are not adequate for computation using `long double's.
Therefore we provide as an extension constants with similar names as a
GNU extension. Provide enough digits for the 128-bit IEEE quad. */
#ifdef __USE_GNU
const
long
double
CONST_El
=
2.7182818284590452353602874713526625
L
;
/* e */
const
long
double
CONST_LOG2El
=
1.4426950408889634073599246810018921
L
;
/* log_2 e */
const
long
double
CONST_LOG10El
=
0.4342944819032518276511289189166051
L
;
/* log_10 e */
const
long
double
CONST_LN2l
=
0.6931471805599453094172321214581766
L
;
/* log_e 2 */
const
long
double
CONST_LN10l
=
2.3025850929940456840179914546843642
L
;
/* log_e 10 */
const
long
double
CONST_PIl
=
3.1415926535897932384626433832795029
L
;
/* pi */
const
long
double
CONST_PI_2l
=
1.5707963267948966192313216916397514
L
;
/* pi/2 */
const
long
double
CONST_PI_4l
=
0.7853981633974483096156608458198757
L
;
/* pi/4 */
const
long
double
CONST_PI_8l
=
0.3926990816987241548078304229099379
L
;
/* pi/8 */
const
long
double
CONST_2_PIl
=
0.6366197723675813430755350534900574
L
;
/* 2/pi */
const
long
double
CONST_2_SQRTPIl
=
1.1283791670955125738961589031215452
L
;
/* 2/sqrt(pi) */
const
long
double
CONST_2PIl
=
6.2831853071795864769252867665590058
L
;
/* 2*pi */
const
long
double
CONST_PI_180l
=
0.0174532925199432957692369076848861
L
;
/* pi/180 */
const
long
double
CONST_180_PIl
=
57.295779513082320876798154814105170
L
;
/* 180/pi */
const
expr
long
double
CONST_El
=
2.7182818284590452353602874713526625
L
;
/* e */
const
expr
long
double
CONST_LOG2El
=
1.4426950408889634073599246810018921
L
;
/* log_2 e */
const
expr
long
double
CONST_LOG10El
=
0.4342944819032518276511289189166051
L
;
/* log_10 e */
const
expr
long
double
CONST_LN2l
=
0.6931471805599453094172321214581766
L
;
/* log_e 2 */
const
expr
long
double
CONST_LN10l
=
2.3025850929940456840179914546843642
L
;
/* log_e 10 */
const
expr
long
double
CONST_PIl
=
3.1415926535897932384626433832795029
L
;
/* pi */
const
expr
long
double
CONST_PI_2l
=
1.5707963267948966192313216916397514
L
;
/* pi/2 */
const
expr
long
double
CONST_PI_4l
=
0.7853981633974483096156608458198757
L
;
/* pi/4 */
const
expr
long
double
CONST_PI_8l
=
0.3926990816987241548078304229099379
L
;
/* pi/8 */
const
expr
long
double
CONST_2_PIl
=
0.6366197723675813430755350534900574
L
;
/* 2/pi */
const
expr
long
double
CONST_2_SQRTPIl
=
1.1283791670955125738961589031215452
L
;
/* 2/sqrt(pi) */
const
expr
long
double
CONST_2PIl
=
6.2831853071795864769252867665590058
L
;
/* 2*pi */
const
expr
long
double
CONST_PI_180l
=
0.0174532925199432957692369076848861
L
;
/* pi/180 */
const
expr
long
double
CONST_180_PIl
=
57.295779513082320876798154814105170
L
;
/* 180/pi */
// Defined but not used?
//const long double CONST_LNPIl = std::log(CONST_PIl); /* ln(pi)*/
//const long double CONST_SQRTPIl = std::sqrt(CONST_PIl); /* sqrt(pi)*/
const
long
double
CONST_SQRT2l
=
1.4142135623730950488016887242096981
L
;
/* sqrt(2) */
const
long
double
CONST_SQRT1_2l
=
0.7071067811865475244008443621048490
L
;
/* 1/sqrt(2) */
const
long
double
CONST_SQRT3l
=
1.7320508075688772935274463415058724
L
;
/* sqrt(3) */
const
long
double
CONST_EULERl
=
0.5772156649015328606065120900824024
L
;
/* euler constant*/
const
expr
long
double
CONST_SQRT2l
=
1.4142135623730950488016887242096981
L
;
/* sqrt(2) */
const
expr
long
double
CONST_SQRT1_2l
=
0.7071067811865475244008443621048490
L
;
/* 1/sqrt(2) */
const
expr
long
double
CONST_SQRT3l
=
1.7320508075688772935274463415058724
L
;
/* sqrt(3) */
const
expr
long
double
CONST_EULERl
=
0.5772156649015328606065120900824024
L
;
/* euler constant*/
#endif
...
...
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