This module contains constants and functions for doing low-level numerics in Fortran. This includes standard real and complex precisions (sp, dp, qp), a "working precision" (wp) that is used as the default precision in GENEUS; some common numerical constants (like pi and the machine epsilon); as well as basic functions for e.g. constructing and deconstructing complex numbers.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | sp | = | real32 |
Single precision |
integer, | public, | parameter | :: | dp | = | real64 |
Double precision |
integer, | public, | parameter | :: | qp | = | real128 |
Quadruple precision |
integer, | public, | parameter | :: | wp | = | dp |
Working precision |
real(kind=wp), | public, | parameter | :: | inf | = | huge(1.0_wp) |
Infinity |
real(kind=wp), | public, | parameter | :: | eps | = | epsilon(1.0_wp) |
Infinitesimal |
real(kind=wp), | public, | parameter | :: | pi | = | atan(1.0_wp)*4.0_wp |
Circle constant |
Returns the real part of a complex number z=x+iy.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=wp), | intent(in) | :: | z |
Complex number |
Real part
Returns the imaginary part of a complex number z=x+iy.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=wp), | intent(in) | :: | z |
Complex number |
Imaginary part
Returns the complex number z=x+iy.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | x |
Real part |
||
real(kind=wp), | intent(in), | optional | :: | y |
Imaginary part |
Complex number
Returns the complex argument θ of a complex number z=r·exp(iθ).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=wp), | intent(in) | :: | z |
Complex number |
Complex argument
If the argument has a finite norm, then it will be rescaled to a unit vector. If that norm is zero, then a zero vector is returned instead.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(3) | :: | v |
Input vector |
Unit vector
Checks whether or not the argument has a finite norm.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(:) | :: | v |
Input vector |
Conclusion