On May 30, 2005, at 6:56 PM, Dennis Brown wrote:
Trunc(number) is simply the integer function. It hands you back the
number with any decimal portions thrown away (no rounding). 10.1
becomes 10 and 10.99999 becomes 10.
Mod is the remainder function from a division. It performs a division
and throws away the answer but hands you back the remainder. 10.99999
mod 10 is 0.99999. 10.99999/10 the answer is 1 with a remainder of
0.99999.
Good summary. I'll add...
Both trunc() and mod have variations in different programming language
and in spreadsheet formulas. They are also found in mathematics. So,
getting up to speed on these is a good investment when one has the
time.
There is a gotcha: negative numbers. Different programming languages
and spreadsheets might define those in slightly different ways that
cause the behavior to be different for negative numbers. More so, a
mathematician or computer scientist might point out that from his
corner, the Transcript "mod" is more like "remainder" and is not the
"mod" function mathematicians use. This is only different for negative
numbers.
My advice--if these are new concepts--is to limit these to positive
numbers until you need to dig deeper.
Dar
--
**********************************************
DSC (Dar Scott Consulting & Dar's Lab)
http://www.swcp.com/dsc/
Programming and software
**********************************************
_______________________________________________
use-revolution mailing list
[email protected]
http://lists.runrev.com/mailman/listinfo/use-revolution