|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
rshandel Smarty Rookie
Joined: 29 Mar 2009 Posts: 16
|
Posted: Thu Sep 02, 2010 4:30 pm Post subject: rounding math equation result |
|
|
I created a math equation:
{math equation="(y-x) / y) * 100" x=$product.price y=$product.list}
How do round off to 2 significant digits?
I know there's a string_format:"%.2f", but I'm not sure how to use it within the math equation.
Thanks |
|
Back to top |
|
rshandel Smarty Rookie
Joined: 29 Mar 2009 Posts: 16
|
Posted: Thu Sep 02, 2010 4:56 pm Post subject: |
|
|
Never mind, had a brain freeze - here's the solution:
{math equation="(y-x) / y) * 100" x=$product.price y=$product.list format="%.2f"} |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|