Re: [Clip] Mathematical Expressions
- At 02:05 PM 9/3/01 -0700, you wrote:
>Hello NoteTabbers,The div Operator
>I am attempting to customize a clip that was posted to this list
>several months ago. My question concerns the use of two functions
>that I do not recognize.
> >From the Help topic "Calculate in NoteTab";
> "NoteTab can also calculate mathematical expressions in a
> document. Expressions can have up to 40 imbedded parentheses.
> [...Snipped for brevity...]
> Accepted operators:
> + , - , * , / , ^ , MOD, DIV"
>I'm doing fine with this topic up to this point, except that I do
>not understand the use of the operators "MOD" and "DIV". Can someone
>provide a brief explanation?
The div operator stands for integer division. The operands must be integer
and its result is integer. The result of
A div B
is the integer you get when you divide A by B and throw away any remainder.
7 div 2
is the integer 3.
-7 div 2
is the integer -3.
The mod Operator
The mod operator stands for the mathematical ``modulo'' operation. Its
operands must both be integer. The general form of the operation is
A mod B
where A and B are expressions. The value of B must be positive.
The result of the mod operation is always non-negative, and is equal to A
modulo B. If A is non-negative, this value will be equal to
A - ( (A div B) * B )
In other words, it is the non-negative remainder that is left after A is
divided by B.
modulo modulo (moj'-l`, mod'y-l`) noun
An arithmetic operation whose result is the remainder of a division
operation. For example, 17 modulo 3 = 2 because 17 divided by 3 yields a
remainder of 2. Modulo operations are used in programming.
[Non-text portions of this message have been removed]