[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: ceiling(), floor(), and data types
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@xxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> 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
|
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
|