function

fdim . math . sncode

VERSIONlatest This function returns the positive difference between the 2 var chosen by the user.

FDIM(1e)

NAME

fdim - This function returns the positive difference between the 2 var chosen by the user.

SYNOPSIS

fdim (x,y)

DESCRIPTION

This mathematical function returns the positive difference between x and y. Y has to be equal or higher than x, otherwise it will return zero. It gives the answer to Y-X.

PARAMETERS

NUMBER
Specifies the two numbers (float) used as argument for the fdim function.

RETURN

The positive difference between x and y.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

One can use this function with integers:

test(q(res={_{fdim(3,10);}}.),q(res=7.));
test(q(res={_{fdim(10,3);}}.),q(res=0.));

With floats:

test(q(res={_{fdim(2.5,3);}}.),q(res=.5.));

One can use this function with another variable:

test(q(res={_{
%include "/includes/extenso.sn";
a=3;
fdim(a,4);
}}.),
q(res=1.));

With a trigonometric function:

test(q(res={_{
%include "/includes/extenso.sn";
a=cos(0);
fdim(0,a);
}}.),
q(res=1.));

With negative numbers:

test(q(res={_{fdim(-3,2);}}.),q(res=5.));

One can also consider the limits:

test(q(res={_{fdim(-INF,INF);}}.),q(res=0.));

With an array, it simply considers its number of elements:

test(q(res={_{fdim(1,[1,2]);}}.),q(res=1.));

AUTHOR

Written by Caroline Laplante, <claplante@sednove.com>