xsl-list
[Top] [All Lists]

Re: [xsl] Implicit casting from double to float

2009-01-07 07:06:22
This could be a more accurate example for the feature I described,

<xsl:variable name="num" select="xs:double('1e4')" as="xs:float" />
<xsl:value-of select="$num" />

This runs fine with Saxon 9.x.

On Wed, Jan 7, 2009 at 3:55 PM, Mukul Gandhi 
<gandhi(_dot_)mukul(_at_)gmail(_dot_)com> wrote:
On Wed, Jan 7, 2009 at 3:28 PM, Andrew Welch 
<andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com> wrote:
I guess it's more like:

Double d = 1e4;
Float f = d.floatValue();

This is a Java syntax for extracting float contents (perhaps, with
loss of information) from a double value, and assigning to a float
variable.

My point was that, float = double assignment gives a compilation error
with Java.

But a
float = double   assignment works with XSLT 2.0 without giving any
warning or a error.

It seems to me, Java has a stricter static typing rules than XSLT 2.0.



-- 
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--