Arithmetics

These documentation pages are no longer maintained. Please visit the new documentation site.

Arithmetic operators

sum

Returns the sum of all parameters, including the input parameter if it is used.

sum( $a, $b, $c ) equal $a + $b + $c

and

$a|sum( $b, $c, $d ) equal $a + $b + $c + $d

sub

Subtracts all extra parameters from the first parameter, e.g.

sub( $a, $b, $c ) equal $a - $b - $c

If an input parameter is supplied that will be considered the first element and the parameters the subtractors, e.g.

$a|sub( $b, $c, $d ) equal $a - $b - $c - $d

inc

Increases either the input value or the first parameter with one. e.g.

{set i=$i|inc}

and

{set i=inc( $i )}

dec

Decreases either the input value or the first parameter with one
e.g.

{set i=$i|dec}

and

{set i=dec( $i )}

div

Divides all extra parameters with the first parameter, e.g.

div( $a, $b, $c ) equal $a / $b / $c

If an input parameter is supplied that will be considered the dividend and the parameters will the divisors, e.g.

$a|div( $b, $c, $d ) equal $a / $b / $c / $d

mod

Returns the modulo of the first input parameter divided by the second. E.g.

mod( 5, 3 )

returns 2.

mul

Multiplies all parameters and returns the result, if an input parameter is supplied it will be included in the multiplication, e.h.

mul( $a,  $b, $c ) equal $a * $b * $c

and

$a|mul( $b, $c ) equal $a * $b * $c

max

Returns the largest value of all parameters, e.g.

max( 2, 3, 1 )

returns 3

min

Returns the smallest value of all parameters, e.g.

min( 2, 3, 1 )

returns 1

abs

Returns a positive value of either the input value or the first parameter. e.g.

{abs(-1)}

,

{-1|abs}

returns 1 and

{abs(200)}

returns 200.

ceil

Returns the next highest integer value by rounding up input value if necessary, e.g.

{ceil(1.2)}

returns 2

floor

Returns the next lowest integer value by rounding down input value if necessary, e.g.

{floor(1.2)}

returns 1

round

Returns the rounded value of input value, e.g.

{round(1.2)}

returns 1, and

{round(1.6)}

returns 2

count

Returns the count of the input value.
How counts are interpreted:
- If the data is an array the array count is used
- If the data is an object the object attribute count is used
- If the data is a string the string length is used
- If the data is a numeric the value is used
- If the data is a boolean false is 0 and true is 1
- For all other data 0 is used
e.g.

{array( 1, 2, 5 )|count}

returns 3

Comments

Contents

Development

Extensions
Exponential datamodel
Exponential tuning and stability
Importing attribute data
Kernel
Libraries
    eZ xml
    eZ db
    eZ i18n
    eZ soap
    eZ template
       Basics
       Functions
       Operators
          Data fetch
          String handling
          Type handling
          Logical handling
          Arithmetics
          Control structure handling
          Array handling
          Image handling
          Miscellaneous
    eZ webdav
Scripting
Standards
System overview
Test Suite
Using Doxygen to create API documenta...


Created

07/07/2003
3:35:01 pm
by Bård Farstad

Last updated

18/11/2003
3:29:10 pm
by Simen Sandberg

Authors

Bård Farstad
Jan Borsodi
Vidar Langseid
Ole Morten Halvorsen
Simen Sandberg



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.