How to use <xen:calc ''> = an integer

starvnnet

Member
I'm editing my template and i use <xen:calc '5/2'>
Value => 2.5 (float number)
Now i want an integer. It mean 5/2 = 2.

Can you help me ?
 

cclaerhout

Well-known member
Code:
{xen:calc "round(5 / 2)"}
Output: 3
Code:
{xen:calc "floor(5 / 2)"}
Output: 2
Code:
{xen:calc "ceil(5 / 2)"}
Output: 3

Other functions compatible with the calc helper: abs, max, min, pow.

Check php manual to see what is the effect of these functions. You can also check inside XenForo templates. There are some.
 

jayramfootball

Active member
Is there some documentation for the different xen:calc functions like 'floor', 'round'. 'ceiling' ? Could someone point me to it... having a hard time finding anything even with some good searches...
 
Top