Skip to content

Commit 00c789a

Browse files
committed
Update doc/specs/stdlib_constants.
1 parent e74ec41 commit 00c789a

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

doc/specs/stdlib_constants.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,33 @@ title: constants
99

1010
The [[stdlib_constants]] module provides mathematical constants and the most common physical constants.
1111

12-
The [[stdlib_codata]] module defines all codata constants as derived type [[codata_constant_type]].
13-
The latest codata constants were released in 2018 by the [NIST](http://physics.nist.gov/constants.)
12+
13+
## Codata
14+
15+
The [[stdlib_codata(module)]] module defines all codata (physical) constants as derived
16+
type. The latest codata constants
17+
were released in 2018 by the [NIST](http://physics.nist.gov/constants)
18+
All values for the codata constants are provided as double precision reals.
1419
The names are quite long and can be aliased with shorter names.
1520

21+
The derived type [[stdlib_codata_type(module):codata_constant_type(type)]] defines:
22+
procedures.
23+
24+
* 4 members:
25+
26+
* `name` (string)
27+
* `value` (double precision real)
28+
* `uncertainty` (double precision real)
29+
* `unit` (string)
30+
31+
* 2 type-bound procedures:
32+
33+
* `print` for print the values of the constant members.
34+
* `to_real` for converting the value or the uncertainty to the desired precision.
35+
36+
A module level interface [[stdlib_codata_type(module):to_real(interface)]] is available for converting the constant value
37+
or uncertainty.
38+
1639

1740
## Example
1841

src/stdlib_codata_type.fypp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#:set KINDS = REAL_KINDS
33
module stdlib_codata_type
44
!! Codata constant type
5+
!! ([Specification](../page/specs/stdlib_constants.html))
56
use stdlib_kinds, only: #{for k in KINDS[:-1]}#${k}$, #{endfor}#${KINDS[-1]}$
67
use stdlib_io, only: FMT_REAL_DP
78
use stdlib_optval, only: optval
@@ -11,7 +12,7 @@ module stdlib_codata_type
1112
!! version: experimental
1213
!!
1314
!! Derived type for representing a Codata constant.
14-
!! [Specification](TOBECOMPLETED)
15+
!! ([Specification](../page/specs/stdlib_constants.html))
1516
character(len=64) :: name
1617
real(dp) :: value
1718
real(dp) :: uncertainty
@@ -46,7 +47,7 @@ elemental pure real(${k}$) function to_real_${k}$(self, mold, uncertainty) resul
4647
!! version: experimental
4748
!!
4849
!! Get the constant value or uncertainty for the kind ${k}$
49-
!! [Specification](TO_BE_COMPLETED)
50+
!! ([Specification](../page/specs/stdlib_constants.html))
5051

5152
class(codata_constant_type), intent(in) :: self !! Codata constant
5253
real(${k}$), intent(in) :: mold !! dummy argument to disambiguate at compile time the generic interface

src/stdlib_constants.fypp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#:set KINDS = REAL_KINDS
33
module stdlib_constants
44
!! Constants
5+
!! ([Specification](../page/specs/stdlib_constants.html))
56
use stdlib_kinds, only: #{for k in KINDS[:-1]}#${k}$, #{endfor}#${KINDS[-1]}$
67
use stdlib_codata, only: SPEED_OF_LIGHT_IN_VACUUM, &
78
VACUUM_ELECTRIC_PERMITTIVITY, &

0 commit comments

Comments
 (0)