Common Pipeline Library Reference 7.3.2
Loading...
Searching...
No Matches
Macros
Fundamental math functionality

Macros

#define CPL_MATH_1_PI   0.3183098861837906715377675267450287240689192914809129
 1/pi
 
#define CPL_MATH_2_PI   0.6366197723675813430755350534900574481378385829618258
 2/pi
 
#define CPL_MATH_2_SQRTPI   1.1283791670955125738961589031215451716881012586579977
 2/sqrt(pi)
 
#define CPL_MATH_2PI   6.2831853071795864769252867665590057683943387987502116
 2 pi
 
#define CPL_MATH_4_PI   1.2732395447351626861510701069801148962756771659236516
 4/pi
 
#define CPL_MATH_DEG_RAD   57.295779513082320876798154814105170332405472466564322
 180/pi
 
#define CPL_MATH_E   2.7182818284590452353602874713526624977572470936999595
 The base of the exponential function.
 
#define CPL_MATH_FWHM_SIG   2.3548200450309493820231386529193992754947713787716411
 FWHM per Sigma, 2.0*sqrt(2.0*log(2.0))
 
#define CPL_MATH_LN10   2.3025850929940456840179914546843642076011014886287730
 The natural logarithm of 10.
 
#define CPL_MATH_LN2   0.6931471805599453094172321214581765680755001343602553
 The natural logarithm of 2.
 
#define CPL_MATH_LOG10E   0.4342944819032518276511289189166050822943970058036666
 log10(e)
 
#define CPL_MATH_LOG2E   1.4426950408889634073599246810018921374266459541529859
 log2(e)
 
#define CPL_MATH_PI   3.1415926535897932384626433832795028841971693993751058
 The ratio of a circles circumference to its diameter.
 
#define CPL_MATH_PI_2   1.5707963267948966192313216916397514420985846996875529
 pi/2
 
#define CPL_MATH_PI_4   0.7853981633974483096156608458198757210492923498437765
 pi/4
 
#define CPL_MATH_RAD_DEG   0.0174532925199432957692369076848861271344287188854173
 pi/180
 
#define CPL_MATH_SIG_FWHM   0.4246609001440095213607514170514448098575705468921770
 Sigma per FWHM, 0.5/sqrt(2.0*log(2.0))
 
#define CPL_MATH_SQRT1_2   0.7071067811865475244008443621048490392848359376884740
 sqrt(1/2)
 
#define CPL_MATH_SQRT2   1.4142135623730950488016887242096980785696718753769481
 The square root of 2.
 
#define CPL_MATH_SQRT2PI   2.5066282746310005024157652848110452530069867406099383
 sqrt(2pi)
 
#define CPL_MATH_SQRT3   1.7320508075688772935274463415058723669428052538103806
 The square root of 3.
 
#define CPL_MATH_STD_MAD   1.4826
 Standard deviation per Median Absolute Deviation for Gaussian data.
 
#define CPL_MAX(first, second)
 Return the maximum of two values.
 
#define CPL_MIN(first, second)
 Return the minimum of two values.
 

Detailed Description

This module provides fundamental math constants.

Source: On-Line Encyclopedia of Integer Sequences (OEIS)

pi: http://www.research.att.com/~njas/sequences/A000796

e: http://www.research.att.com/~njas/sequences/A001113

ln(2): http://www.research.att.com/~njas/sequences/A002162

ln(10): http://www.research.att.com/~njas/sequences/A002392

sqrt(2): http://www.research.att.com/~njas/sequences/A002193

sqrt(3): http://www.research.att.com/~njas/sequences/A002194

The derived constants have been computed with the GNU Multiple-Precision Library v. 4.2.2.

The constants are listed with a precision that allows a one-line definition.

Synopsis:
#include <cpl_math_const.h>

Macro Definition Documentation

◆ CPL_MATH_1_PI

#define CPL_MATH_1_PI   0.3183098861837906715377675267450287240689192914809129

1/pi

See also
CPL_MATH_PI
Note
Derived from a fundamental constant

◆ CPL_MATH_2_PI

#define CPL_MATH_2_PI   0.6366197723675813430755350534900574481378385829618258

2/pi

See also
CPL_MATH_PI
Note
Derived from a fundamental constant

◆ CPL_MATH_2_SQRTPI

#define CPL_MATH_2_SQRTPI   1.1283791670955125738961589031215451716881012586579977

2/sqrt(pi)

See also
CPL_MATH_PI
Note
Derived from a fundamental constant

◆ CPL_MATH_2PI

#define CPL_MATH_2PI   6.2831853071795864769252867665590057683943387987502116

2 pi

See also
CPL_MATH_PI
Note
Derived from a fundamental constant

◆ CPL_MATH_4_PI

#define CPL_MATH_4_PI   1.2732395447351626861510701069801148962756771659236516

4/pi

See also
CPL_MATH_PI
Note
Derived from a fundamental constant

◆ CPL_MATH_DEG_RAD

#define CPL_MATH_DEG_RAD   57.295779513082320876798154814105170332405472466564322

180/pi

See also
CPL_MATH_PI
Note
Derived from a fundamental constant

◆ CPL_MATH_E

#define CPL_MATH_E   2.7182818284590452353602874713526624977572470936999595

The base of the exponential function.

See also
On-Line Encyclopedia of Integer Sequences (OEIS), http://www.research.att.com/~njas/sequences/A001113

◆ CPL_MATH_FWHM_SIG

#define CPL_MATH_FWHM_SIG   2.3548200450309493820231386529193992754947713787716411

FWHM per Sigma, 2.0*sqrt(2.0*log(2.0))

See also
CPL_MATH_LN2
Note
Derived from a fundamental constant

◆ CPL_MATH_LN10

#define CPL_MATH_LN10   2.3025850929940456840179914546843642076011014886287730

The natural logarithm of 10.

See also
On-Line Encyclopedia of Integer Sequences (OEIS), http://www.research.att.com/~njas/sequences/A002392

◆ CPL_MATH_LN2

#define CPL_MATH_LN2   0.6931471805599453094172321214581765680755001343602553

The natural logarithm of 2.

See also
On-Line Encyclopedia of Integer Sequences (OEIS), http://www.research.att.com/~njas/sequences/A002162

◆ CPL_MATH_LOG10E

#define CPL_MATH_LOG10E   0.4342944819032518276511289189166050822943970058036666

log10(e)

See also
CPL_MATH_LN10
Note
Derived from a fundamental constant

◆ CPL_MATH_LOG2E

#define CPL_MATH_LOG2E   1.4426950408889634073599246810018921374266459541529859

log2(e)

See also
CPL_MATH_LN2
Note
Derived from a fundamental constant

◆ CPL_MATH_PI

#define CPL_MATH_PI   3.1415926535897932384626433832795028841971693993751058

The ratio of a circles circumference to its diameter.

See also
On-Line Encyclopedia of Integer Sequences (OEIS), http://www.research.att.com/~njas/sequences/A000796

◆ CPL_MATH_PI_2

#define CPL_MATH_PI_2   1.5707963267948966192313216916397514420985846996875529

pi/2

See also
CPL_MATH_PI
Note
Derived from a fundamental constant

◆ CPL_MATH_PI_4

#define CPL_MATH_PI_4   0.7853981633974483096156608458198757210492923498437765

pi/4

See also
CPL_MATH_PI
Note
Derived from a fundamental constant

◆ CPL_MATH_RAD_DEG

#define CPL_MATH_RAD_DEG   0.0174532925199432957692369076848861271344287188854173

pi/180

See also
CPL_MATH_PI
Note
Derived from a fundamental constant

◆ CPL_MATH_SIG_FWHM

#define CPL_MATH_SIG_FWHM   0.4246609001440095213607514170514448098575705468921770

Sigma per FWHM, 0.5/sqrt(2.0*log(2.0))

See also
CPL_MATH_LN2
Note
Derived from a fundamental constant

◆ CPL_MATH_SQRT1_2

#define CPL_MATH_SQRT1_2   0.7071067811865475244008443621048490392848359376884740

sqrt(1/2)

See also
CPL_MATH_SQRT2
Note
Derived from a fundamental constant

◆ CPL_MATH_SQRT2

#define CPL_MATH_SQRT2   1.4142135623730950488016887242096980785696718753769481

The square root of 2.

See also
On-Line Encyclopedia of Integer Sequences (OEIS), http://www.research.att.com/~njas/sequences/A002193

◆ CPL_MATH_SQRT2PI

#define CPL_MATH_SQRT2PI   2.5066282746310005024157652848110452530069867406099383

sqrt(2pi)

See also
CPL_MATH_PI
Note
Derived from a fundamental constant

◆ CPL_MATH_SQRT3

#define CPL_MATH_SQRT3   1.7320508075688772935274463415058723669428052538103806

The square root of 3.

See also
On-Line Encyclopedia of Integer Sequences (OEIS), http://www.research.att.com/~njas/sequences/A002194

◆ CPL_MATH_STD_MAD

#define CPL_MATH_STD_MAD   1.4826

Standard deviation per Median Absolute Deviation for Gaussian data.

See also
cpl_image_get_mad_window()

For a Gaussian distribution the Median Absolute Deviation (MAD) is a robust and consistent estimate of the Standard Deviation (STD) in the sense that the STD is approximately K * MAD, where K is a constant equal to approximately 1.4826.

◆ CPL_MAX

#define CPL_MAX (   first,
  second 
)

Return the maximum of two values.

Parameters
firstThe first expression in the comparison
secondThe second expression in the comparison
Returns
The maximum of the two values
See also
CPL_MIN()

◆ CPL_MIN

#define CPL_MIN (   first,
  second 
)

Return the minimum of two values.

Parameters
firstThe first expression in the comparison
secondThe second expression in the comparison
Returns
The minimum of the two values
Note
If the first argument is the smallest then it is evaluated twice otherwise the second argument is evaluated twice