In my Smarty 3 template I have this code:
{$a=8.34}
{$b=8.33}
{$a-$b|round:2}
Expected result is: 0.01
But I receive this: 0.0099999999999998
Does anybody know how to fix this?
Smarty2 applied the modifier to the result of the complete expression.
Smarty3 does it just on the direct prepending value.
So in Smarty3 you have to use brackets:
{($a-$b)|round:2}
That should solve it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With