From 427b92e210ed61238dda30c9398b0e06049723ea Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Sat, 11 Feb 2017 06:19:58 -0800 Subject: [PATCH] Use Float.compare in java equals Reviewed By: astreet Differential Revision: D4531805 fbshipit-source-id: 723e15381e9fa39837a4c99f726501eda26af11b --- ReactAndroid/src/main/java/com/facebook/yoga/YogaValue.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaValue.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaValue.java index 1110eded20b..f9c0ebfc4e4 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaValue.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaValue.java @@ -33,7 +33,9 @@ public class YogaValue { public boolean equals(Object other) { if (other instanceof YogaValue) { final YogaValue otherValue = (YogaValue) other; - return value == otherValue.value && unit == otherValue.unit; + if (unit == otherValue.unit) { + return unit == YogaUnit.UNDEFINED || Float.compare(value, otherValue.value) == 0; + } } return false; }