rounding - round in Smarty shows wrong result -


in smarty 3 template have code:

{$a=8.34} {$b=8.33} {$a-$b|round:2} 

expected result is: 0.01

but receive this: 0.0099999999999998

does know how fix this?

smarty2 applied modifier result of complete expression.

smarty3 on direct prepending value.

so in smarty3 have use brackets:

{($a-$b)|round:2}  

that should solve it.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -