Skip to content

Commit 4d16ee4

Browse files
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
1 parent b72efaa commit 4d16ee4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

yoga/Yoga.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3650,7 +3650,7 @@ YOGA_EXPORT float YGRoundValueToPixelGrid(
36503650
const float pointScaleFactor,
36513651
const bool forceCeil,
36523652
const bool forceFloor) {
3653-
float scaledValue = value * pointScaleFactor;
3653+
double scaledValue = ((double) value) * pointScaleFactor;
36543654
// We want to calculate `fractial` such that `floor(scaledValue) = scaledValue
36553655
// - fractial`.
36563656
float fractial = fmodf(scaledValue, 1.0f);

0 commit comments

Comments
 (0)