xsl-list
[Top] [All Lists]

Re: [xsl] XPath MOD 10 calculation

2007-05-25 08:28:05
On 5/25/07, David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:
Note you only need to do that if calculating the check digit, (when it
matters that you get 0 not 10) if you are just checking that a given
checksum is right then you don't need that complication as using 10 or 0
is the same in a (..) mod 10 = 0 test.

If you a_re_ calculating the digit, rather than write
(10 - (foo mod 10)) mod 10
it's probably more natural just to use
-(-foo mod 10)

Out of interest, why is:

-(-foo mod 10)

not the same as:

foo mod 10

?

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--