From 335ee1a1bb80922e4a96e3a92a27671ea92b60d7 Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Thu, 28 May 2026 12:14:23 -0500 Subject: [PATCH] Fix negative zero in imperial feet-inches parser When the user enters `-0' - 10"`, Python parses feet as -0.0. The check `feet < 0` is False for negative zero, so the sign was silently dropped. Use math.copysign to detect it correctly. Generated with the assistance of an AI coding tool. --- src/bonsai/bonsai/tool/unit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bonsai/bonsai/tool/unit.py b/src/bonsai/bonsai/tool/unit.py index 4c3e45b794..5bef7feae1 100644 --- a/src/bonsai/bonsai/tool/unit.py +++ b/src/bonsai/bonsai/tool/unit.py @@ -199,8 +199,8 @@ class Unit(bonsai.core.tool.Unit): if inches is None: inches = 0 - # If feet is negative, inches should also be negative (subtractive) - if feet < 0: + # If feet is negative (including -0), inches should also be negative (subtractive) + if math.copysign(1, feet) < 0: inches = -inches # Convert to meters