Function Repository Resource:

Monus

Source Notebook

Truncate negative numbers in the result of subtraction

Contributed by: Wolfram Staff

ResourceFunction["Monus"][x,y]

is equivalent to x-y, but gives zero if the result would be negative.

Examples

Basic Examples (2) 

Subtract two numbers:

In[1]:=
ResourceFunction["Monus"][10, 3]
Out[1]=
In[2]:=
ResourceFunction["Monus"][3, 10]
Out[2]=

Subtract symbolic values and substitute numbers:

In[3]:=
ResourceFunction["Monus"][a, b]
Out[3]=
In[4]:=
% /. {a -> 10, b -> 3}
Out[4]=
In[5]:=
%% /. {a -> 3, b -> 10}
Out[5]=

Version History

  • 1.0.0 – 12 December 2019

License Information