RE: F&O comments on substring

> 
> 
> 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 UTC