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.
This commit is contained in:
Ryan Schultz
2026-05-28 12:14:23 -05:00
parent 1325705d8e
commit 335ee1a1bb
+2 -2
View File
@@ -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