

It will show incorrect results if the absolute value of the exponent is larger than 15.It won't work if you have positive exponents without the +.The last concat argument deals with the case where the number is not in scientific notation. where the exponent b is an integer, and the coefficient. In scientific notation, all numbers are written like this: a × 10b. Since you will either have e+ or e-, one of them will be the string NaN which is then removed from the final string using the translate function (it removes all N and a characters, which never occur in decimal numbers or scientific notation). Scientific notation (also called standard form or exponential notation) is a way of writing numbers that accommodates values too large or small to be conveniently written in standard decimal notation.
It then will multiply that number with the mantissa. If it is +5 it will get 10000 and if it is -3 it will extract the 0.001 substring from the second or fourth strings. Since there is no if in XPath, it concatenates both results as strings, and allows one of them to produce 'NaN, which is removed later.įor example, if the exponent is +2 it will get the 100 substring from the first or third string. It deals separately with the case of positive or negative exponents. It extracts the mantissa (string before the E or e) and then obtains a fraction or power of 10 by shifting a string of zeros the amount of positions determined by the exponent, Then it multiplies this with the mantissa. If you are stuck with XPath 1.0 and your input is of the form ( mantissa E+ exponent) or ( mantissa E- exponent) you can use this hack (which is not very nice but gets the job done): translate(
