This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 10072 - math:sqrt incorrectly listed in section 4.7 "Trigonometric functions"
Summary: math:sqrt incorrectly listed in section 4.7 "Trigonometric functions"
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.0 (show other bugs)
Version: Working drafts
Hardware: All All
: P2 trivial
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL: http://www.w3.org/TR/xpath-functions-...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-03 03:04 UTC by dnovatchev
Modified: 2010-07-13 22:20 UTC (History)
1 user (show)

See Also:


Attachments

Description dnovatchev 2010-07-03 03:04:48 UTC
math:sqrt is incorrectly listed in section 4.7 "Trigonometric functions" http://www.w3.org/TR/xpath-functions-11/#func-sqrt.

It is well-known that the sqrt() function is in the clas of exponential functions -- x^a, where a = 1/2.

Therefore, this function should not be listed under "trigonometric functions.


Dimitre Novatchev
Comment 1 Michael Kay 2010-07-03 11:29:30 UTC
Thanks for the observation. I may have been influenced by the fact that the categorization of the functions in the 2.0/1.0 spec is hopelessly illogical, and serves very little useful purpose. So at least I'm maintaining a tradition. But I'll try to do better.
Comment 2 Michael Kay 2010-07-13 11:31:02 UTC
I changed the section heading to "trigonometric and other mathematical".

The WG agreed this was editorial, and it has been reclassified accordingly.
Comment 3 dnovatchev 2010-07-13 12:54:46 UTC
(In reply to comment #2)
> I changed the section heading to "trigonometric and other mathematical".
> The WG agreed this was editorial, and it has been reclassified accordingly.

While this is a step in the right direction, the new heading sounds ... strange.

The right solution is to have:

   Math Functions
     Exponential
     Trigonometric

Or, even better:

   Math Functions and Constants
     Constants
     Functions
         Exponential
         Trigonometric

While it is possible, presenting pi as a function seems weird and unnatural. Following this path we should have:

  math:one()
  math:zero()
  math:two()
  math:e()
  math:pi()
  math:ten()

Then, the next step would be to forbid writing:1, 0, 2, 10, or considering this unnatural.

Going in this direction would be considered wrong by most programmers and may hurt the serious adoption of XPath, XQuery and XSLT.

Dimitre Novatchev
Comment 4 David Carlisle 2010-07-13 13:12:26 UTC
(In reply to comment #3)

[note this is not a WG comment, just an interested observer]




> While it is possible, presenting pi as a function seems weird and unnatural.

Technically it's no different from having true() and false() as functions is it?
Comment 5 dnovatchev 2010-07-13 13:39:32 UTC
(In reply to comment #4)
> (In reply to comment #3)
> [note this is not a WG comment, just an interested observer]
> > While it is possible, presenting pi as a function seems weird and unnatural.
> Technically it's no different from having true() and false() as functions is
> it?

In fact it *is* different. We do not have two literal boolean values but we do have numeric literals.

While the constructors true() and false() give us a *unique* representation of all possible boolean values, introducing functions to represent numerical constants results in a *redundant* representation for some numerical values.

Maybe we should be aware that there are some issues arising from redundancy?
Comment 6 Michael Kay 2010-07-13 22:20:38 UTC
>The right solution is to have:

   Math Functions
     Exponential
     Trigonometric

The section structure of this document was designed, I think, to help readers find their way around the spec, not to provide a rigorous taxonomy of the functions on offer. As a taxonomy, the hierarchy considered as a whole is indefensible; if we had a section headed "Math Functions" then it would immediately invite comment as to why a number of other functions were not present in this section.

But I'm going to have to reconsider the section headings anyway as the WG has today decided to add a number of other functions such as exp, log, and pow.

> Presenting pi as a function seems weird and unnatural

Interesting reaction: I'm surprised by it. I have to say that to me presenting a constant as a zero-argument function seems entirely natural. The only other way of doing it that comes to mind is a built-in global variable, and that seems less consistent with other design decisions made in the language, notably the presentation of true() and false(). 

>While the constructors true() and false() give us a *unique* representation of
all possible boolean values, introducing functions to represent numerical
constants results in a *redundant* representation for some numerical values.

I'm sorry, I don't follow that argument: why is it bad to have a redundant representation of some numbers?  Is it bad that in "2" and "+2" we have two redundant representations of the number 2? 

If you don't like presenting pi() as a function, what would you prefer?