Skip to content

Commit 9ed73a8

Browse files
committed
AC-13855: Penny rounding error in catalog rule
Use sprintf to solve the precision issue
1 parent 123a8c8 commit 9ed73a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/code/Magento/Directory/Model/PriceCurrency.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function round($price)
154154
{
155155
// To fix rounding error in PHP 8.4
156156
if (str_contains(PHP_VERSION, '8.4')) {
157-
return round(round((float) $price, 3), 2);
157+
return round((float)sprintf("%.3f", $price), 2);
158158
}
159159
return round((float) $price, 2);
160160
}

0 commit comments

Comments
 (0)