Re: [xsl] XPath MOD 10 calculation

Subject: Re: [xsl] XPath MOD 10 calculation
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 25 May 2007 16:22:20 +0100
> > 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. 
________________________________________________________________________

Current Thread