xsl-list
[Top] [All Lists]

Re: [xsl] ceiling(), floor(), and data types

2017-09-14 09:24:02
Answering "why" questions about specs is notoriously difficult. Do you want a 
historical exposition of how and when the decisions were made, or do you simply 
want an opinion as to why a reasonable designer might have chosen to do it that 
way?

Looking at the history, the WG discussed the point on 5 Dec 2001. The minutes 
record:

Add issue: what do float, ceiling, and round return? Is it always a
   decimal, or the same type as their argument (are they overloaded), or ...

   Note that xf:substring("foo", round(1.5)) would require an explicit cast
   if round returns a double.

   Add issue: what do float, ceiling, and round return if the argument is
   NaN, etc.?

Important context here is that ceiling() and floor() were present in XPath 1.0 
when there was only one numeric data type (effectively xs:double). That meant 
that in XPath 1.0, ceiling(NaN) returned NaN, and perhaps the WG wanted to keep 
it that way.

Michael Kay
Saxonica


On 14 Sep 2017, at 11:30, Birnbaum, David J djbpitt(_at_)pitt(_dot_)edu 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Dear XSL List,

I was surprised to learn today that ceiling() and floor() do not obligatorily 
return a value of type xs:integer. If I've understood correctly that they 
necessarily return a value that a human would consider an integer, is there a 
reason that other return types are permitted?

Thanks,

David
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>