Simbody  3.7
Mathematical Constants

These are some common unitless numerical constants evaluated to 64 digits and written here in maximal (long double) precision. More...

## Macros

#define SimTK_PI   3.141592653589793238462643383279502884197169399375105820974944592L
The ratio pi of a circle's circumference to its diameter in Euclidean geometry. More...

#define SimTK_E   2.718281828459045235360287471352662497757247093699959574966967628L
e, or exp(1). More...

#define SimTK_LN2   6.931471805599453094172321214581765680755001343602552541206800095e-1L
The natural (base e) logarithm of 2. More...

#define SimTK_LN10   2.302585092994045684017991454684364207601101488628772976033327901L
The natural (base e) logarithm of 10. More...

#define SimTK_LOG2E   1.442695040888963407359924681001892137426645954152985934135449407L
log2(e). More...

#define SimTK_LOG10E   4.342944819032518276511289189166050822943970058036665661144537832e-1L
log10(e). More...

#define SimTK_SQRT2   1.414213562373095048801688724209698078569671875376948073176679738L
The square root of 2. More...

#define SimTK_OOSQRT2   .7071067811865475244008443621048490392848359376884740365883398690L
One over the square root of 2; also half the square root of 2 since 1/sqrt(2) == 2^(-1/2) == sqrt(2)/2. More...

#define SimTK_CBRT2   1.259921049894873164767210607278228350570251464701507980081975112L
The cube root of 2, 2^(1/3). More...

#define SimTK_OOCBRT2   .7937005259840997373758528196361541301957466639499265049041428810L
One over the cube root of 2, 2^(-1/3). More...

#define SimTK_SIXRT2   1.122462048309372981433533049679179516232411110613986753440409546L
The sixth root of 2, 2^(1/6). More...

#define SimTK_OOSIXRT2   .8908987181403393047402262055905125079872126158781604033837569922L
One over the sixth root of 2, 2^(-1/6). More...

#define SimTK_SQRT3   1.732050807568877293527446341505872366942805253810380628055806979L
The square root of 3. More...

#define SimTK_CBRT3   1.442249570307408382321638310780109588391869253499350577546416195L
The cube root of 3. More...

## Detailed Description

These are some common unitless numerical constants evaluated to 64 digits and written here in maximal (long double) precision.

(These values were generated using the symbolic calculator Maple which is part of Matlab's Symbolic Toolbox.) These can be cast to lower precisions when needed, and can be used in compile-time constant expressions like 2*SimTK_PI or 1/SimTK_SQRT2 for which the compiler will properly calculate a long double result with no runtime cost.

These constants are also available as type-safe, already-rounded, precision-templatized values with static memory addresses as part of our scalar system (see NTraits<T>). You should use the templatized versions when possible. The templatized versions also contain more elaborate constants such as NaN, Infinity, and "epsilon" (machine precision) which can only be generated for specific types.

## ◆ SimTK_PI

 #define SimTK_PI   3.141592653589793238462643383279502884197169399375105820974944592L

The ratio pi of a circle's circumference to its diameter in Euclidean geometry.

uncertainty
approximation of an exact value

## ◆ SimTK_E

 #define SimTK_E   2.718281828459045235360287471352662497757247093699959574966967628L

e, or exp(1).

uncertainty
approximation of an exact value

## ◆ SimTK_LN2

 #define SimTK_LN2   6.931471805599453094172321214581765680755001343602552541206800095e-1L

The natural (base e) logarithm of 2.

uncertainty
approximation of an exact value
SimTK_E

## ◆ SimTK_LN10

 #define SimTK_LN10   2.302585092994045684017991454684364207601101488628772976033327901L

The natural (base e) logarithm of 10.

uncertainty
approximation of an exact value
SimTK_E

## ◆ SimTK_LOG2E

 #define SimTK_LOG2E   1.442695040888963407359924681001892137426645954152985934135449407L

log2(e).

uncertainty
approximation of an exact value

## ◆ SimTK_LOG10E

 #define SimTK_LOG10E   4.342944819032518276511289189166050822943970058036665661144537832e-1L

log10(e).

uncertainty
approximation of an exact value

## ◆ SimTK_SQRT2

 #define SimTK_SQRT2   1.414213562373095048801688724209698078569671875376948073176679738L

The square root of 2.

uncertainty
approximation of an exact value

## ◆ SimTK_OOSQRT2

 #define SimTK_OOSQRT2   .7071067811865475244008443621048490392848359376884740365883398690L

One over the square root of 2; also half the square root of 2 since 1/sqrt(2) == 2^(-1/2) == sqrt(2)/2.

uncertainty
approximation of an exact value

## ◆ SimTK_CBRT2

 #define SimTK_CBRT2   1.259921049894873164767210607278228350570251464701507980081975112L

The cube root of 2, 2^(1/3).

uncertainty
approximation of an exact value

## ◆ SimTK_OOCBRT2

 #define SimTK_OOCBRT2   .7937005259840997373758528196361541301957466639499265049041428810L

One over the cube root of 2, 2^(-1/3).

uncertainty
approximation of an exact value

## ◆ SimTK_SIXRT2

 #define SimTK_SIXRT2   1.122462048309372981433533049679179516232411110613986753440409546L

The sixth root of 2, 2^(1/6).

uncertainty
approximation of an exact value

## ◆ SimTK_OOSIXRT2

 #define SimTK_OOSIXRT2   .8908987181403393047402262055905125079872126158781604033837569922L

One over the sixth root of 2, 2^(-1/6).

uncertainty
approximation of an exact value

## ◆ SimTK_SQRT3

 #define SimTK_SQRT3   1.732050807568877293527446341505872366942805253810380628055806979L

The square root of 3.

uncertainty
approximation of an exact value

## ◆ SimTK_CBRT3

 #define SimTK_CBRT3   1.442249570307408382321638310780109588391869253499350577546416195L

The cube root of 3.

uncertainty
approximation of an exact value