- From: <bugzilla@wiggum.w3.org>
- Date: Tue, 25 Nov 2008 18:35:49 +0000
- To: public-qt-comments@w3.org
http://www.w3.org/Bugs/Public/show_bug.cgi?id=6212 --- Comment #2 from Michael Kay <mike@saxonica.com> 2008-11-25 18:35:49 --- Looking at the current text: <quote> Summary: This function backs up the "idiv" operator and performs an integer division: that is, it divides the first argument by the second, and returns the integer obtained by truncating the fractional part of the result. The division is performed so that the sign of the fractional part is the same as the sign of the dividend. If the dividend, $arg1, is not evenly divided by the divisor, $arg2, then the quotient is the xs:integer value obtained, ignoring (truncating) any remainder that results from the division (that is, no rounding is performed). Thus, the semantics " $a idiv $b " are equivalent to " ($a div $b) cast as xs:integer " except for error situations. </quote> we seem to have a long sequence of separate attempts to specify the function, each trying to say the same thing in different words, but none of them achieving real precision. I think the following text does the job more cleanly: <quote> Summary: This function backs up the "idiv" operator by performing an integer division. If the divisor is (positive or negative) zero, then an error is raised [err:FOAR0001]. If either operand is NaN or if $arg1 is INF or -INF then an error is raised [err:FOAR0002]. Otherwise, subject to limits of precision and overflow/underflow conditions, the result is the largest (furthest from zero) xs:integer value $I such that fn:abs($I * $arg2) <= fn:abs($arg1) and fn:compare($I * $arg2, 0) = fn:compare($arg1, 0). The implementation may adopt a different algorithm provided that it is equivalent to this formulation in all cases where implementation-dependent or implementation-defined behaviour does not affect the outcome, for example, the implementation-defined precision of the result of xs:decimal division. Note: Except in situations involving errors, loss of precision, or overflow/underflow, the result of ($a idiv $b) is the same as (($a div $b) cast as xs:integer). The semantics of this function are different from integer division as defined in programming languages such as Java and C++. </quote> -- Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug.
Received on Tuesday, 25 November 2008 18:39:24 UTC