W3C home > Mailing lists > Public > public-qt-comments@w3.org > November 2002

RE: F&O comments on substring

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Thu, 21 Nov 2002 15:00:57 +0100
Message-ID: <DFF2AC9E3583D511A21F0008C7E621060453DDD6@daemsg02.software-ag.de>
To: Priscilla Walmsley <priscilla@walmsley.com>, public-qt-comments@w3.org

> 
> 
> A comment on the substring function:
> 
> I think the 3rd example is incorrect.  -INF + 3 is still 
> -INF, so wouldn't it return ""?
> 
> Thanks,
> Priscilla
> 

yes, you are right.

There is another error here as well: -INF is not a representation of minus
infinity. It should be written

  fn:double("-INF")
or
  -1 div 0

(Ashok, why not simply revert to the XPath 1.0 examples?)


I've just been checking the formula, which is written as:

 fn:round($startingLoc) <= $p < fn:round($startingLoc + fn:round($length))  

whereas XPath 1.0 uses the simpler:

 fn:round($startingLoc) <= $p < fn:round($startingLoc) + fn:round($length)

I think they're equivalent, but to avoid the effort of proving it, I think
it would be better to use the latter (which is more efficient because the
$startingLoc only needs to be rounded once).

Michael Kay   
Received on Thursday, 21 November 2002 09:01:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:13:58 GMT