[xquery-talk] type of 1.2 div 1.2?

Howard Katz howardk at fatdog.com
Wed Mar 23 07:25:50 PST 2005


Right. That makes sense. Thanks for the clarification.
Howard

 > -----Original Message-----
 > From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com]On Behalf
 > Of Michael Kay
 > Sent: Wednesday, March 23, 2005 12:50 AM
 > To: howardk at fatdog.com; talk at xquery.com
 > Subject: RE: [xquery-talk] type of 1.2 div 1.2?
 > 
 > 
 > I think that fs:untyped-to-double is a no-op if the argument isn't
 > untypedAtomic, just as fn:data() is a no-op if the argument is atomic.
 > 
 > Remember that Galax is following the formal semantics very literally,
 > regardless of efficiency.
 > 
 > Michael Kay 
 > 
 > > -----Original Message-----
 > > From: Howard Katz [mailto:howardk at fatdog.com] 
 > > Sent: 23 March 2005 00:51
 > > To: Michael Kay; talk at xquery.com
 > > Subject: RE: [xquery-talk] type of 1.2 div 1.2?
 > > 
 > > Oops, mea culpa. I misread something. I'm looking at galax, 
 > > and typeswitch
 > > shows that the final result is actually decimal as it should 
 > > be. What threw
 > > me was an intermediate result, which shows the normalized core
 > > representation for this query as:
 > > 
 > >   op:numeric-divide(
 > >   fs:untyped-to-double(fn:data(1.2)),
 > >   fs:untyped-to-double(fn:data(1.2))
 > > 
 > > Given this, I still don't understand:
 > > 
 > > (1) why there's an untyped-to-double conversion, since I 
 > > would have thought
 > > the grammar provided the typing information on the numerics as decimal
 > > literals,
 > > and
 > > (2) even if there are intermediate doubles, how we get from 
 > > there to a final
 > > decimal result?
 > > 
 > > Howard
 > > 
 > >  > -----Original Message-----
 > >  > From: talk-bounces at xquery.com 
 > > [mailto:talk-bounces at xquery.com]On Behalf
 > >  > Of Michael Kay
 > >  > Sent: Tuesday, March 22, 2005 12:30 PM
 > >  > To: howardk at fatdog.com; talk at xquery.com
 > >  > Subject: RE: [xquery-talk] type of 1.2 div 1.2?
 > > 
 > >  >
 > >  > The result should definitely be of type xs:decimal.
 > >  >
 > >  > There's some debate about whether it's permissible to 
 > > return a subtype of
 > >  > xs:decimal, e.g. xs:integer or my:veryShortInteger; but
 > >  > returning xs:double
 > >  > is not on.
 > >  >
 > >  > (Unless this is actually an XPath processor with 1.0 
 > > compatibility mode
 > >  > enabled).
 > >  >
 > >  > Michael Kay
 > >  > http://www.saxonica.com/
 > >  >
 > >  >
 > >  > > -----Original Message-----
 > >  > > From: talk-bounces at xquery.com
 > >  > > [mailto:talk-bounces at xquery.com] On Behalf Of Howard Katz
 > >  > > Sent: 22 March 2005 18:44
 > >  > > To: talk at xquery.com
 > >  > > Subject: [xquery-talk] type of 1.2 div 1.2?
 > >  > >
 > >  > > What's the type and value of the single atomic returned 
 > > by the query:
 > >  > >
 > >  > >      1.2 div 1.2
 > >  > >
 > >  > > I'm looking at different implementations. I see one returning an
 > >  > > xsd:decimal, value 1 as a result (my understanding as well).
 > >  > > I see another
 > >  > > treating the data as untyped and doing two conversions to
 > >  > > xsd:double first,
 > >  > > again returning a value of 1 but this time of type xsd:double.
 > >  > >
 > >  > > Which one is correct?
 > >  > > Howard
 > >  > >
 > >  > >
 > >  > >
 > >  > > _______________________________________________
 > >  > > talk at xquery.com
 > >  > > http://xquery.com/mailman/listinfo/talk
 > >  > >
 > >  >
 > >  >
 > >  > _______________________________________________
 > >  > talk at xquery.com
 > >  > http://xquery.com/mailman/listinfo/talk
 > >  >
 > > 
 > > 
 > > 
 > 
 > 
 > _______________________________________________
 > talk at xquery.com
 > http://xquery.com/mailman/listinfo/talk
 > 



More information about the talk mailing list