Constants

This chapter describes some constants uniquely defined as macros in the C header mad_cst.h and available from modules MAD.constant and MAD._C (C API) as floating point double precision variables.

Numerical Constants

These numerical constants are provided by the system libraries. Note that the constant huge differs from math.huge, which corresponds in fact to inf.

MAD constants

C macros

C constants

Values

eps

DBL_EPSILON

mad_cst_EPS

Smallest representable step near one

tiny

DBL_MIN

mad_cst_TINY

Smallest representable number

huge

DBL_MAX

mad_cst_HUGE

Largest representable number

inf

INFINITY

mad_cst_INF

Positive infinity, \(1/0\)

nan

NAN

mad_cst_NAN

Canonical NaN [1], \(0/0\)

Mathematical Constants

This section describes some mathematical constants uniquely defined as macros in the C header mad_cst.h and available from C and MAD modules as floating point double precision variables. If these mathematical constants are already provided by the system libraries, they will be used instead of their local definitions.

MAD constants

C macros

C constants

Values

e

M_E

mad_cst_E

\(e\)

log2e

M_LOG2E

mad_cst_LOG2E

\(\log_2(e)\)

log10e

M_LOG10E

mad_cst_LOG10E

\(\log_{10}(e)\)

ln2

M_LN2

mad_cst_LN2

\(\ln(2)\)

ln10

M_LN10

mad_cst_LN10

\(\ln(10)\)

lnpi

M_LNPI

mad_cst_LNPI

\(\ln(\pi)\)

pi

M_PI

mad_cst_PI

\(\pi\)

twopi

M_2PI

mad_cst_2PI

\(2\pi\)

pi_2

M_PI_2

mad_cst_PI_2

\(\pi/2\)

pi_4

M_PI_4

mad_cst_PI_4

\(\pi/4\)

one_pi

M_1_PI

mad_cst_1_PI

\(1/\pi\)

two_pi

M_2_PI

mad_cst_2_PI

\(2/\pi\)

sqrt2

M_SQRT2

mad_cst_SQRT2

\(\sqrt 2\)

sqrt3

M_SQRT3

mad_cst_SQRT3

\(\sqrt 3\)

sqrtpi

M_SQRTPI

mad_cst_SQRTPI

\(\sqrt{\pi}\)

sqrt1_2

M_SQRT1_2

mad_cst_SQRT1_2

\(\sqrt{1/2}\)

sqrt1_3

M_SQRT1_3

mad_cst_SQRT1_3

\(\sqrt{1/3}\)

one_sqrtpi

M_1_SQRTPI

mad_cst_1_SQRTPI

\(1/\sqrt{\pi}\)

two_sqrtpi

M_2_SQRTPI

mad_cst_2_SQRTPI

\(2/\sqrt{\pi}\)

rad2deg

M_RAD2DEG

mad_cst_RAD2DEG

\(180/\pi\)

deg2rad

M_DEG2RAD

mad_cst_DEG2RAD

\(\pi/180\)

Physical Constants

This section describes some physical constants uniquely defined as macros in the C header mad_cst.h and available from C and MAD modules as floating point double precision variables.

MAD constants

C macros

C constants

Values

minlen

P_MINLEN

mad_cst_MINLEN

Min length tolerance, default \(10^{-10}\) in [m]

minang

P_MINANG

mad_cst_MINANG

Min angle tolerance, default \(10^{-10}\) in [1/m]

minstr

P_MINSTR

mad_cst_MINSTR

Min strength tolerance, default \(10^{-10}\) in [rad]

The following table lists some physical constants from the CODATA 2018 sheet.

MAD constants

C macros

C constants

Values

clight

P_CLIGHT

mad_cst_CLIGHT

Speed of light, \(c\) in [m/s]

mu0

P_MU0

mad_cst_MU0

Permeability of vacuum, \(\mu_0\) in [T.m/A]

epsilon0

P_EPSILON0

mad_cst_EPSILON0

Permittivity of vacuum, \(\epsilon_0\) in [F/m]

qelect

P_QELECT

mad_cst_QELECT

Elementary electric charge, \(e\) in [C]

hbar

P_HBAR

mad_cst_HBAR

Reduced Plack’s constant, \(\hbar\) in [GeV.s]

amass

P_AMASS

mad_cst_AMASS

Unified atomic mass, \(m_u\,c^2\) in [GeV]

emass

P_EMASS

mad_cst_EMASS

Electron mass, \(m_e\,c^2\) in [GeV]

pmass

P_PMASS

mad_cst_PMASS

Proton mass, \(m_p\,c^2\) in [GeV]

nmass

P_NMASS

mad_cst_NMASS

Neutron mass, \(m_n\,c^2\) in [GeV]

mumass

P_MUMASS

mad_cst_MUMASS

Muon mass, \(m_{\mu}\,c^2\) in [GeV]

deumass

P_DEUMASS

mad_cst_DEUMASS

Deuteron mass, \(m_d\,c^2\) in [GeV]

eradius

P_ERADIUS

mad_cst_ERADIUS

Classical electron radius, \(r_e\) in [m]

alphaem

P_ALPHAEM

mad_cst_ALPHAEM

Fine-structure constant, \(\alpha\)

Footnotes