W3C home > Mailing lists > Public > public-qt-comments@w3.org > December 2003

[F&O] 6.2.6 op:numeric-mod

From: David Carlisle <davidc@nag.co.uk>
Date: Tue, 2 Dec 2003 17:19:45 GMT
Message-Id: <200312021719.RAA26940@penguin.nag.co.uk>
To: public-qt-comments@w3.org


The description of mod uses expressions the expression
(a idiv b)*b+(a mod b) 
that is (one assumes) XPath/Xquery, (although other cases of explict
xpath examples the operators have op: or fn: syntax so this probably
ought to be
op:numeric-multiply(op:numeric-integer-divide(a,b) ,b)...


however it also uses the phrase

  the result obeys (a/b)*b+(a mod b) = a. Division is truncating division,
  analogous to integer division, not [IEEE 754-1985] rounding division.

The expression there is a valid Xpath, but not the desired expression:-)
I assume that the second sentence is intended to give a local definition
of "/" but
a) I think some other syntax should be used in
   preference to "/" to avoid confusion, and
b) I don't think "analogous to integer division" is clear enough as a
   specification.

If a and b are positive I assume you want something 
equivalent to the Xpath floor(a div b)*b+(a mod b) = a
Although It's not clear whether mod should be _defined_ that way in
terms of the Xpath floor and div (which may affect certain edge cases).


David


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
Received on Tuesday, 2 December 2003 12:20:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:14:28 GMT