xsl-list
[Top] [All Lists]

Re: [xsl] XPath MOD 10 calculation

2007-05-25 08:22:44

It is needed for calculating the check digit, in the special case that
the steps 1..3 produce 10 (which is, if the $totalsums mod 10 equal 0).
10 is not allowed as digit. Doing modulo 10, will give 0.

Ahh - thanks for the clarification.

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)


David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

--~------------------------------------------------------------------
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>
--~--