[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Implicit casting from double to float
Well... I don't find it surprising that you can find a result that differs from Java, the type systems are different so there will be differences. However I can't actually verify that this should work in XSLT. (Without thinking too hard, and it's probably just easier to mumble and get Michael to point to the right bit of the spec:-) xsl:variable uses function conversion rules, so we seem to arrive at point 3 in (the third list in) http://www.w3.org/TR/xpath20/#id-function-calls > 3. For each numeric item in the atomic sequence that can be promoted to the > expected atomic type using numeric promotion as described in B.1 Type > Promotion, the promotion is done. so the question is, can we get from a double to a float? B.1 Type Promotion > A value of type xs:float (or any type derived by restriction from > xs:float) can be promoted to the type xs:double so that's the wrong direction, > A value of type xs:decimal (or any type derived by restriction from > xs:decimal) can be promoted to either of the types xs:float or > xs:double. The result of this promotion is created by casting the > original value to the required type. This kind of promotion may cause > loss of precision. so that's the right direction, but going from decimal to float (losing precision) not double to float. so, I think that numeric promotion doesn't convert a double to a float, so the question is do they match anyway, and that question is answerd by the SequenceType matching rules. I think the answer is no, as xsd:float isn't derived from xsd:double. David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|