Project

Profile

Help

Unwanted scientific repr. of numerics

Added by Anonymous over 18 years ago

Legacy ID: #3684640 Legacy Poster: Mystwalker (mystwalker)

Hi there, using Saxon 8.7.1, when I process the following statement: <xsl:value-of select="round-half-to-even(sum(current-group()/Amount), 2)"/> I get: 7.09891375E6 Instead of the wanted: 7098913.75 But AFAIK, the output shouldn't be in scientific notation, should it? How can I change this? Thanks in advance! Cheers, Dennis


Replies (3)

Please register to reply

RE: Unwanted scientific repr. of numerics - Added by Anonymous over 18 years ago

Legacy ID: #3684647 Legacy Poster: Mystwalker (mystwalker)

Follow-up: I've just noticed that the scientific notation is only used for the exponent 6, not for exponents 4 and 5. I guess only multiples of 3 are affected?

RE: Unwanted scientific repr. of numerics - Added by Anonymous over 18 years ago

Legacy ID: #3684704 Legacy Poster: Michael Kay (mhkay)

The XPath 2.0 rule for conversion from double to string is that exponential notation is used if the value is outside the range 1e-6 to 1e+6. Rather than using round-half-to-even, I would suggest using format-number: format-number(sum(current-group()/Amount), '0.00') Michael Kay

RE: Unwanted scientific repr. of numerics - Added by Anonymous over 18 years ago

Legacy ID: #3684749 Legacy Poster: Mystwalker (mystwalker)

That solved my problem - thanks, Michael! Now that I knew what to look for, I found it in the recommondation...

    (1-3/3)

    Please register to reply