[Bug 2735] Need for exact semantics in casting string to decimal


------- Additional Comments From mike@saxonica.com  2006-01-20 20:48 -------
A couple of comments:

(a) casting from string to decimal should be consistent with schema validation.
Casting shouldn't fail if validation succeeds. I believe that under these
circumstances, validation does succeed.

(b) I can certainly think of use cases where users would want the rounding
behaviour rather than failure - not for literals, perhaps, but certainly for
dynamically constructed strings. For example, if a decimal value is computed by
an XQuery application running under one implementation, and is then serialized
to an XML document which is transmitted over the network and read by an XQuery
application running under a different implementation, and if the decimal value
happens to be the result of dividing 1 by 7, then I think that the author of the
application would not expect the receiving application to fail simply because
the two XQuery implementations support differing decimal precision. They would
expect to get whatever the lower-precision implementation supports.

Michael Kay

Received on Friday, 20 January 2006 20:48:12 UTC