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

pentaho - Carte Status / Kettle Slave Server Status page shows status for random runs instead of the latest run -

R summary function in ddply (plyr) in a simple way -

c# - Are delegates created via lambda expressions guaranteed to be cached? -