Other Functions

Function

Example

Description
if(a, b, c)
(a is a boolean expression)
if(eq(5,5),5,0)
=5
Returns b if the boolean expression is true (a=1) and c if the expression is false (a=0)
sig(n,x)

sig(4,2.1)
=2.100

Returns x expressed to n significant digits

condition:   

 

$a = rand(1, 20);
$b = rand(1, 20);
condition: not(eq($a, $b));
$c = 1/($a - $b);

The condition statement evaluates the right-hand side expression. If the expression evaluates to a nonzero value, subsequent statements are processed. Otherwise (if the condition fails), the randomization script is reprocessed from the top, with new randomization values.

decimal(n, x)

decimal(3,5.64)
=5.640

Returns x expressed as a floating point number to n decimal places.

lsu(n,x) lsu(3, 3.14159)
= 0.01,
(0.01 being a unit in the 3rd significant place)
Returns the least significant unit of x in the n'th place.
int(x) int(8.740)
=8
Returns the integer part of x
     
sum(var, start, stop, expr)

sum(i, 1, 10, i^2)
=385
( sum of the squares of the integers from 1 to 10).

Returns the result of summing the expression expr as the variable var runs through the values start to stop (inclusive).
fact(n) fact(5)
= 120
(5x4x3x2)

Computes n-factorial.

strcat(a,b,c,...) strcat("cats ", "and", " dogs")
="cats and dogs"
It returns a string obtained by concatenating (connecting) the arguments.
min(a,b,c...) min(5,3,9,11,4)
=3
Returns the minimum value in the list.
max(a,b,c...) max(4,8,33,1,23,5)
=33

Returns the maximum value in the list.


Back to Tutorials