enketo / enketo-xpathjs

Cross-browser OpenRosa-extended XPath 1.0 implementation in JavaScript.
MIT License
6 stars 10 forks source link

int() cannot deal with scientific notation #54

Closed MartijnR closed 8 years ago

MartijnR commented 8 years ago
  1. Don't use parseInt, because if you supply a number in scientific notation (e.g. a very large or very small number), it will convert to string first and this results in e.g. parseInt(2.08e-11) = 2 instead of 0.
  2. Consider tweaking String.toNumber in enketo-xpathjs so it can convert "2.08e+3" to 2808, but check native XPath evaluator first.
MartijnR commented 8 years ago

2 is not feasible because the browser's built-in XPath evaluator is compliant with XPath 1.0 (checked Chrome)