RyanSkraba commented on code in PR #3744:
URL: https://github.com/apache/avro/pull/3744#discussion_r3176352337


##########
lang/csharp/src/apache/main/AvroDecimal.cs:
##########
@@ -1140,20 +1140,14 @@ public int CompareTo(AvroDecimal other)
             var unscaledValueCompare = 
UnscaledValue.CompareTo(other.UnscaledValue);
             var scaleCompare = Scale.CompareTo(other.Scale);
 
-            // if both are the same value, return the value
-            if (unscaledValueCompare == scaleCompare)
-            {
-                return unscaledValueCompare;
-            }
-
             // if the scales are both the same return unscaled value
             if (scaleCompare == 0)
             {
                 return unscaledValueCompare;
             }
 
-            var scaledValue = BigInteger.Divide(UnscaledValue, 
BigInteger.Pow(new BigInteger(10), Scale));
-            var otherScaledValue = BigInteger.Divide(other.UnscaledValue, 
BigInteger.Pow(new BigInteger(10), other.Scale));
+            var scaledValue = (decimal) UnscaledValue / (decimal) Math.Pow(10, 
Scale);

Review Comment:
   Am I right in thinking the old version *only* compared the two as whole 
numbers?  As in `2.5` ==`2.51` ?  This looks better to me! 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to