From b96534794d4fddbbeabd2720c8f5b62e4d20fe61 Mon Sep 17 00:00:00 2001 From: Elliot Larez <61991911+larezelliot@users.noreply.github.com> Date: Fri, 18 Sep 2026 18:45:33 -0400 Subject: [PATCH] Fix crash when printing 0 in human-readable format Resolves #3787 --- nerfstudio/utils/printing.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nerfstudio/utils/printing.py b/nerfstudio/utils/printing.py index 1fc4e99a8..7c8fef6c9 100644 --- a/nerfstudio/utils/printing.py +++ b/nerfstudio/utils/printing.py @@ -37,6 +37,12 @@ def human_format(num): Args: num: number to format """ + # Prevents math domain error + if num == 0: + return "0.00" + if num < 0: + return f"-{human_format(-num)}" + units = ["", "K", "M", "B", "T", "P"] k = 1000.0 magnitude = int(floor(log(num, k)))