This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 28514 - [QT3] format-integer-044 does not take minus-sign into account
Summary: [QT3] format-integer-044 does not take minus-sign into account
Status: RESOLVED INVALID
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3 & XPath 3 Test Suite (show other bugs)
Version: Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: O'Neil Delpratt
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-20 04:11 UTC by Abel Braaksma
Modified: 2015-04-20 14:05 UTC (History)
1 user (show)

See Also:


Attachments

Description Abel Braaksma 2015-04-20 04:11:27 UTC
This test tests format-integer(-5, 'Ww;o') to be equal to "-Fifth", but in words, this is "Minus Fifth".

I think this ought to be changed to accommodate for this variant:

<any-of>
    <assert-eq>'-Fifth'</assert-eq>
    <assert-eq>'Minus Fifth'</assert-eq>
</any-of>
Comment 1 Michael Kay 2015-04-20 07:57:46 UTC
This would require a spec change, and the spec change would create a backwards incompatibility.
Comment 2 Abel Braaksma 2015-04-20 13:42:51 UTC
Oh, my bad, I didn't find it in the spec under "w", "W" and "Ww", but now I see that there's a line saying:

    If the value of $value is negative, the rules below are applied to the 
    absolute value of $value, and a minus sign is prepended to the result.

It looks so odd. Anyway, it was not my intention to suggest a spec change, I thought the test was wrong. Apparently not.
Comment 3 Michael Kay 2015-04-20 14:01:15 UTC
I think code that wants to handle negative numbers with format-integer will often apply format-integer to the absolute value, and then "do its own thing" to indicate that it is negative. For example

"The temperature is " || format-integer(abs($N)) || " degrees " || (if ($N gt 0) then "above zero" else if ($N lt 0) then "below zero" else "".
Comment 4 Abel Braaksma 2015-04-20 14:05:01 UTC
Yes, that makes sense. Thanks.