W3C home > Mailing lists > Public > public-qt-comments@w3.org > June 2015

[Bug 28845] New: fn:format-number, formatting rules for exponential notation

From: <bugzilla@jessica.w3.org>
Date: Wed, 24 Jun 2015 09:20:46 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-28845-523@http.www.w3.org/Bugs/Public/>

            Bug ID: 28845
           Summary: fn:format-number, formatting rules for exponential
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators 3.1
          Assignee: mike@saxonica.com
          Reporter: christian.gruen@gmail.com
        QA Contact: public-qt-comments@w3.org

I have a slightly hard time understanding the formatting semantics for the new
exponential notation of fn:format-number. This the current wording for Rule 4
and 5:

4. If the sub-picture contains a percent-sign, the number is multiplied by 100.
If the sub-picture contains a per-mille-sign, the number is multiplied by 1000.
The resulting number is referred to below as the adjusted number.

5. If the minimum exponent size is non-zero, then the adjusted number is scaled
to establish a mantissa and an integer exponent. The mantissa and exponent are
chosen such that

  (a) the primitive type of the mantissa is the same as the primitive type of
the adjusted number (integer, decimal, float, or double),
  (b) the mantissa multiplied by ten to the power of the exponent is equal to
the adjusted number, and
  (c) the number of significant digits in the integer part of the mantissa is
equal to the minimum integer part size.

Some comments/questions:

- Rule 4: The following sentence could be added (provided that it's correct):
"If there is no percent-sign or per-mille-sign, the adjusted number will be
equal to the original number."

- Rule 5a is clear, but 5b and 5c is a bit confusing to me (although I'm sorry
I cannot provide a better solution yet, because I don't understand the exact
semantics yet). Is the leading zero of a number larger than 0 and smaller than
1 a "significant digit"? What is going to happen if the minimum integer part
size is 0 and if there are optional digit signs in the integer part of the
pattern? In the current test cases "numberformat135" and "numberformat136"...

  fn:format-number(0.2, '#.e9')
  fn:format-number(0.2, '9e9') 

...the expected result is "2e-1". Is the result correct for both test cases?

Thanks in advance,

You are receiving this mail because:
You are the QA Contact for the bug.
Received on Wednesday, 24 June 2015 09:20:48 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:54 UTC