Skip to content

Commit 6557d91

Browse files
committed
Update documentation for the interface to_real.
1 parent 4ac5d84 commit 6557d91

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

doc/specs/stdlib_constants.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,39 @@ procedures.
3232
* 2 type-bound procedures:
3333

3434
* `print` for print the values of the constant members.
35-
* `to_real` for converting the value or the uncertainty to the desired precision.
35+
* `to_real` for getting the value or the uncertainty to the desired precision.
3636

37-
A module level interface [[stdlib_codata_type(module):to_real(interface)]] is available for converting the constant value
38-
or uncertainty.
37+
A module level interface [[stdlib_codata_type(module):to_real(interface)]] is
38+
available for getting the constant value or uncertainty of a constant.
3939

40+
## `to_real` - Get the constant value or uncertainty.
41+
42+
### Status
43+
44+
Experimental
45+
46+
### Description
47+
48+
Convert a [[stdlib_codata_type(module):stdlib_codata_type(type)]] to a real.
49+
**Warning**: Some constants cannot be converted to simple precision reals due to the values of the exponents.
50+
51+
### Syntax
52+
53+
`r = ` [[stdlib_codata_type(module):to_real(interface)]] `(c, mold [, uncertainty])`
54+
55+
### Arguments
56+
57+
`c`: argument has `intent(in) ` and shall be of type [[stdlib_codata_type(module):stdlib_codata_type(type)]].
58+
59+
`mold`: argument has `intent(in)` and shall be of `real` type.
60+
**Note**: The type of the `mold` argument defines the type of the result.
61+
62+
`uncertainty` (optional): argument has `intent(in)` and shall be of `logical` type.
63+
It specifies if the uncertainty needs to be returned instead of the value. Default to `.false.`.
64+
65+
### Return value
66+
67+
Returns a scalar of `real` type which is either the value or the uncertainty of a codata constant.
4068

4169
## Example
4270

src/stdlib_codata_type.fypp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ elemental pure real(${k}$) function to_real_${k}$(self, mold, uncertainty) resul
5151

5252
class(codata_constant_type), intent(in) :: self !! Codata constant
5353
real(${k}$), intent(in) :: mold !! dummy argument to disambiguate at compile time the generic interface
54-
logical, intent(in), optional :: uncertainty !! Set to true if the uncertainty is required
54+
logical, intent(in), optional :: uncertainty !! Set to true if the uncertainty is required. Default to .false..
5555
!!
5656
logical :: u
5757

0 commit comments

Comments
 (0)