|
1 | 1 | program example_constants
|
2 | 2 | use stdlib_constants, only: c, PI=>PI_dp
|
3 | 3 | use stdlib_codata, only: alpha=>ALPHA_PARTICLE_ELECTRON_MASS_RATIO
|
4 |
| - use stdlib_codata, only: ATOMIC_UNIT_OF_1ST_HYPERPOLARIZABILITY |
| 4 | + use stdlib_codata_type, only : to_real |
| 5 | + use stdlib_kinds, only: dp, sp |
5 | 6 |
|
6 |
| - call alpha%print() |
| 7 | + ! Use most common physical constants defined as deouble precision reals |
| 8 | + print *, "speed of light in vacuum= ", c |
| 9 | + |
| 10 | + ! Use of mathematical constants such as PI |
| 11 | + print *, "PI as double precision real= ", PI |
| 12 | + |
| 13 | + ! Use codata_constant type for evaluating the value to the desired precision |
| 14 | + print *, "Value of alpha... evaluated to double precision=", alpha%to_real(1.0_dp) |
| 15 | + print *, "Uncertainty of alpha... evaluated to double precision=", alpha%to_real(1.0_sp, .true.) |
| 16 | + print *, "Value of alpha... evaluated to single precision=", alpha%to_real(1.0_sp) |
7 | 17 |
|
8 |
| - print *, ATOMIC_UNIT_OF_1ST_HYPERPOLARIZABILITY%eval_value(1.0) |
| 18 | + ! Convert a codata constant to a real |
| 19 | + print *, "Value of the alpha... evaluated to double precision=", to_real(alpha, 1.0_dp) |
9 | 20 |
|
10 |
| - print *, c |
11 |
| - print *, PI |
| 21 | + |
| 22 | + ! Print out codata constant attributes: name, value, uncertainty and unit |
| 23 | + call alpha%print() |
12 | 24 |
|
13 | 25 | end program example_constants
|
0 commit comments