From 86c50a5094c345850011940d11cf305c8e971eff Mon Sep 17 00:00:00 2001 From: Chandra Patni Date: Wed, 1 Nov 2017 15:42:41 -0700 Subject: [PATCH] use `> || YGFloatsEqual` instead of `>=` for computing round value to pixel grid Reviewed By: emilsjolander Differential Revision: D6202484 fbshipit-source-id: bb80235452208caec388775574cc4f07bfd649c4 --- ReactCommon/yoga/yoga/Yoga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactCommon/yoga/yoga/Yoga.c b/ReactCommon/yoga/yoga/Yoga.c index 9486724bd..45b37b9d8 100644 --- a/ReactCommon/yoga/yoga/Yoga.c +++ b/ReactCommon/yoga/yoga/Yoga.c @@ -3322,7 +3322,7 @@ float YGRoundValueToPixelGrid(const float value, scaledValue = scaledValue - fractial; } else { // Finally we just round the value - scaledValue = scaledValue - fractial + (fractial >= 0.5f ? 1.0f : 0.0f); + scaledValue = scaledValue - fractial + (fractial > 0.5f || YGFloatsEqual(fractial, 0.5f) ? 1.0f : 0.0f); } return scaledValue / pointScaleFactor; }