This file defines a module containing the machine size of single-precision, double-precision, and quadruple-precision floating point numbers; to declare the floating point precision of a variable, use real(sp), real(dp), or real(qp) as the type of the variable. It also defines the working-precision, which will be the default kind for module procedures. As for module procedures, this library defines some common utility functions for working with e.g. 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) | Numerical infinity |
real(kind=wp), | public, | parameter | :: | eps | = | epsilon(1.0_wp) | Numerical 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 | 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 | Vector |
Finite