feat: use N/A for round value

This commit is contained in:
Matthias
2025-11-23 08:30:10 +01:00
parent efabcef330
commit d0fb4cdc37

View File

@@ -31,6 +31,8 @@ def round_value(value: float, decimals: int, keep_trailing_zeros=False) -> str:
:param keep_trailing_zeros: Keep trailing zeros "222.200" vs. "222.2" :param keep_trailing_zeros: Keep trailing zeros "222.200" vs. "222.2"
:return: Rounded value as string :return: Rounded value as string
""" """
if isnan(value):
return "N/A"
val = f"{value:.{decimals}f}" val = f"{value:.{decimals}f}"
if not keep_trailing_zeros: if not keep_trailing_zeros:
val = strip_trailing_zeros(val) val = strip_trailing_zeros(val)