Use double for YGRoundValueToPixelGrid calculations

Summary:
Use double for YGRoundValueToPixelGrid calculations as we were losing some precision in float operations

#Changelog:
[Internal][Yoga] Use double for YGRoundValueToPixelGrid calculations

Reviewed By: astreet

Differential Revision: D18225999

fbshipit-source-id: 69c05f56a0e0f3433bf0bd958aa07d26dd83fe02
This commit is contained in:
Sidharth Guglani
2019-11-05 17:12:39 -08:00
committed by Facebook Github Bot
parent b72efaaaca
commit 4d16ee4ed4

View File

@@ -3650,7 +3650,7 @@ YOGA_EXPORT float YGRoundValueToPixelGrid(
const float pointScaleFactor,
const bool forceCeil,
const bool forceFloor) {
float scaledValue = value * pointScaleFactor;
double scaledValue = ((double) value) * pointScaleFactor;
// We want to calculate `fractial` such that `floor(scaledValue) = scaledValue
// - fractial`.
float fractial = fmodf(scaledValue, 1.0f);