You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently if users are interested in well-controlling the position of the decimal separator within a string they can do so using round_mode="dec_place" and left_pad_dec_place. E.g.
from sciform import Formatter
formatter = Formatter(
round_mode="dec_place",
ndigits=5,
left_pad_char=0,
left_pad_dec_place=4,
)
for number in (123, 3453.39485345, 39.532, 9, 42, 8923.9823423):
print(formatter(number))
# 00123.00000
# 03453.39485
# 00039.53200
# 00009.00000
# 00042.00000
# 08923.98234
Because dec_place rounding is not supported for value/uncertainty formatting this same strategy is not possible.
The text was updated successfully, but these errors were encountered:
I've leaned away from including this feature because I think dec_place rounding is a bad practice for value/uncertainty formatting. The official recommendations indicate that value/uncertainty pairs should be formatted according to significant digits of the uncertainty. However, it seems there is anyways demand to "line up" decimal symbols by controlling the digits to the right of the decimal symbol with dec_place and ndigits and the decimal to the left of the decimal symbol with left_pad_dec_place.
I will include this feature along with a recipe for how to line up decimal symbols in the examples. But I'll include in the documentation caution against using round_mode="dec_place" and explanation for the caution. The main issues are (1) if too few digits of uncertainty are shown then the uncertainty may be rendered as something like 0.0000 and (2) too many digits of uncertainty may be shown such as 1.23456789 when really only the first one or two are typically known or needed.
Currently if users are interested in well-controlling the position of the decimal separator within a string they can do so using
round_mode="dec_place"
andleft_pad_dec_place
. E.g.Because
dec_place
rounding is not supported for value/uncertainty formatting this same strategy is not possible.The text was updated successfully, but these errors were encountered: