From d21331cb65049e07d393fb6c79fcd5fd23d9224b Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 20 Jan 2026 23:02:14 -0600 Subject: [PATCH] Enhance fuzzy equality function for improved precision handling - Updated the fuzzyEq function to utilize both absolute and relative epsilon for better precision when comparing numbers. This change improves the handling of small and large values, ensuring more accurate equality checks in the reconciliation process. --- plugin/src/Reconciler/diff.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin/src/Reconciler/diff.lua b/plugin/src/Reconciler/diff.lua index 96de9cbd..d16efecd 100644 --- a/plugin/src/Reconciler/diff.lua +++ b/plugin/src/Reconciler/diff.lua @@ -43,7 +43,12 @@ local function findDuplicateNames(children: { Instance } | { string }, virtualIn end local function fuzzyEq(a: number, b: number, epsilon: number): boolean - return math.abs(a - b) < epsilon + local diff = math.abs(a - b) + -- Use both absolute and relative epsilon for better precision handling + -- Absolute: for small numbers near zero + -- Relative: for larger numbers where absolute epsilon is too tight + local maxVal = math.max(math.abs(a), math.abs(b), 1) + return diff < epsilon or diff < maxVal * epsilon end local function trueEquals(a, b): boolean