RE: [F&O] 6.2.6 op:numeric-mod

Thanks, this problem has already been pointed out (by me) and we're looking
at it.

I have made the suggestion that idiv should be defined on all numeric types.
This would mean that [10 idiv xdt:untypedAtomic("2.5")] returns 4, not 5 as
it does currently. It would also mean (I think) that the expression [(a idiv
b)*b+(a mod b) = a] becomes true for all numeric values a and b.

Michael Kay


> -----Original Message-----
> From: David Carlisle [mailto:davidc@nag.co.uk] 
> Sent: 02 December 2003 17:20
> To: public-qt-comments@w3.org
> Subject: [F&O] 6.2.6 op:numeric-mod
> 
> 
> 
> 
> 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:49:09 UTC