[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: ceiling(), floor(), and data types

Subject: Re: ceiling(), floor(), and data types
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 14 Sep 2017 14:23:57 -0000
Re:  ceiling()
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.