[Home] [By Thread] [By Date] [Recent Entries]

  • From: COUTHURES Alain <alain.couthures@a...>
  • To: Michael Kay <mike@s...>, 'Kurt Cagle' <kurt.cagle@g...>, xml-dev@l...
  • Date: Fri, 26 Jun 2009 09:48:01 +0200

Michael,
5CB9F5B20B44430ABA3C3433159847A5@Sealion" type="cite">
In fact, I'm more concerned with validation than evaluation. 
    
...
  
Wouldn't it be great if "1/3 + 2/3" was exactly like "1" ? As 
    

Then you seem to be very concerned with evaluation. There are languages that
perform rational arithmetic which would make this expression return the
integer 1, but XPath is certainly not one of them, and as far as I know
Javascript isn't either.

  
You're right saying that there can't be validation without evaluation.

For version 1, use of rational numbers would be "at-your-own-risks" and Javascript eval() function is enough for perfect results with +, - and * operators and decimal numbers. The result will always be a decimal number. Evaluation version 1 is already available with Javascript.

For version 2, rational numbers could be added. I have found Jasymca (http://webuser.hs-furtwangen.de/~dersch/jasymca2/index.html), written in Java for PDAs and it seems pretty fast and light :
                rat(3/5)+rat(1/3) gives 14/15 as answer !

I wouldn't say that XPath can't perform rational arithmetic but rather that rational arithmetic is not yet implemented for XPath. Benefits for scientists, financials,... Integrating this with XForms will permit users to set fields in web applications without a calculator always at hand.

For version 1 and version 2, validation has to start with evaluation which wasn't required before. So, validation has to be modified. The same for XPath which has to evaluate node content before using it.

Does it still sound like an impossible feature ?

Best regards,

Alain Couthures
<agenceXML>
http://www.agencexml.com



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member