From 75b207937349ae4390c977fad28968af81c4135d Mon Sep 17 00:00:00 2001 From: Glenwing Date: Sat, 30 Jun 2018 09:24:46 -0700 Subject: [PATCH] XOR sign detection --- division/test.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/division/test.html b/division/test.html index 7fe4d9a..415999a 100644 --- a/division/test.html +++ b/division/test.html @@ -55,9 +55,12 @@ (1 non-repeating + 1-digit repeating pattern) (1 non-repeating + 3-digit repeating pattern)   + (integer result) (1-decimal evenly-divisible result) (6-decimal evenly-divisible result) - (negative result) + (negative A) + (negative B) + (negative A and B) @@ -181,7 +184,7 @@ var Sign = Plus_Sign; // Determine if answer will be negative, then use the absolute value of inputs for the rest of the calculations. - if ((A / B) < 0) { Sign = Minus_Sign; } + if ((A < 0) ? !(B < 0) : (B < 0)) { Sign = Minus_Sign; } // If (A is negative) XOR (B is negative) then final result will be negative. var Dividend = Math.abs(parseFloat(A)); var Divisor = Math.abs(parseFloat(B));