XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Formulas in XML values

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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS