fdim

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

FDIM

NAME

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

SYNOPSIS

fdim (number x,number 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.));

SEE ALSO

{{ include("includes/maths.sn") }}

AUTHOR

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

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.