Skip to content

Commit

Permalink
Add note on string not containing uncertainty to ufloat_fromstr docst…
Browse files Browse the repository at this point in the history
…ring
  • Loading branch information
Cs137 committed Jan 20, 2025
1 parent c1fd095 commit 2d64785
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Adds:

Fixes:

- add note on string not containing uncertainty to `ufloat_fromstr` doctring (#287)
- fix typos in `ufloat_fromstr` docstring examples (#285)
- fix `readthedocs` configuration so that the build passes (#254)
- adjust `codecov.io` configuration so that minor code coverage changes will not result
Expand Down
6 changes: 6 additions & 0 deletions uncertainties/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,11 @@ def ufloat_fromstr(representation, tag=None):
That is, "1.25(3)" is the same as `ufloat(1.25, 0.03)`,
while "1.25(3.)" is the same as `ufloat(1.25, 3.)`
3. If the representation does not contain an uncertainty, an
uncertainty of 1 in the least significant digit is assigned to
the nominal value. For nominal values corresponding to "nan", an
uncertainty of 1 is assigned.
Examples:
-----------
Expand All @@ -998,6 +1003,7 @@ def ufloat_fromstr(representation, tag=None):
>>> x = ufloat_fromstr("680(41)e-3") # = ufloat(0.68, 0.041)
>>> x = ufloat_fromstr("23.2") # = ufloat(23.2, 0.1)
>>> x = ufloat_fromstr("23.29") # = ufloat(23.29, 0.01)
>>> x = ufloat_fromstr("nan") # = ufloat(numpy.nan, 1.0)
>>> x = ufloat_fromstr("680.3(nan)") # = ufloat(680.3, numpy.nan)
"""
Expand Down

0 comments on commit 2d64785

Please sign in to comment.