# More F&O issues

From: XQuery <xquery@attbi.com>
Date: Sat, 25 Jan 2003 23:42:40 -0800

Message-ID: <000001c2c50e\$814f7f40\$6601a8c0@brundage1>
```
5.2
- After the link to Issue 177 (reporting underflow/overflow), there is a
list that starts "Finally, consider some examples involving special IEEE 754
numerics."  This list is nonsense.  Although the first bullet stands, the
other two bullets do not.  To take just two examples, 1 div INF is 0.0 and
INF + -INF is NaN.

[This is like the bajillionth time the XQuery drafts have said "IEEE 754"
and something nonsensical a sentence later.  If you don't understand
computer arithmetic, please don't attempt to summarize how it works.]

5.2.6
- The definition of op:numeric-mod is incorrect.  It is not "the remainder
after dividing the first operand by the second", because xs:decimal division
is exact (there would never be a remainder).  I suspect you mean that M mod
N is the unique value 0 <= r < N such that q * N + r = M for some integer q.
You should also consider what happens for negative M and N, or N = +/-1 and
ensure the definition makes sense for these cases.

- The list of special casts for xs:float and xs:double seems incorrect.
Specifically, the third bullet says that if not NaN, the sign of the result
equals the sign of the dividend.  But then combined with the last bullet,
this means that -X mod X = -X mod -X = -0.0.  I'm pretty sure both of these
should be +0.0.  Can you clarify?  (Very few IEEE operations result in -0.0
-- typically, just division and multiplication.  The modulus is defined by
addition/subtraction, so I'm wary of a modulo definition that yields -0.0 in
anything other than exceptional cases.)

14.2.7, 14.2.8
- Are these functions allowed to return the result in any order even when
there were no duplicates?  The text seems to say yes, the examples seem to
say no.

14.2.9, 14.2.10
- The description of insert/remove is incorrect.  Why should floor() be
applied to position (which is already typed as integer in the function
signature)?  Also notice that the cast to unsignedInt will fail with an
error if N is less than 0, so the first condition in the following paragraph
would never apply. [Probably just need to remove the second paragraph, the
one invoking the cast.]

- I assume that the phrase "a copy ... is returned" is just trying to
clarify that the original sequence is unmodified.  However, you have to take
care here, because this could also be interpreted as meaning that all items
in the returned sequence have been copied (which would destroy node
identity).
```
Received on Sunday, 26 January 2003 02:43:24 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:11 UTC