[Unicode]   Common Locale Data Repository : Bug Tracking Home | Site Map | Search
 
Modify

CLDR Ticket #10703(closed: fixed)

Opened 14 months ago

Last modified 6 weeks ago

Clarify behavior of empty and identical negative subpattern

Reported by: shane Owned by: mark
Component: numbers Data Locale:
Phase: spec-beta Review: shane
Weeks: Data Xpath:
Xref:

ticket:10207

Description (last modified by shane) (diff)

Follow-up on ICU ticket 13117.

The question is what should be the behavior with the patterns "0;" and "0;0". The relevant section from the spec (LDML) says,

When there is no explicit negative subpattern, an implicit negative subpattern is formed from the positive pattern with a prefixed - (ASCII U+002D HYPHEN-MINUS).

What should be the behavior? Here is what I think makes the most sense. In particular, if we are given a negative subpattern, we should respect it. Note: This is the behavior in ICU4J 59.

0 0; 0;0
15 15 15 15
-15 -15 -15 15

Here is the behavior of Excel (see screenshot). It produces an empty string for an empty pattern, which might be OK for us, too:

0 0; 0;0
15 15 15 15
-15 -15 <empty> 15

https://snag.gy/bgCi9y.jpg

ICU4C and older versions of ICU4J put a negative sign on the last entry in the table. I think this is wrong because we are not respecting the user's explicit negative subpattern:

0 0; 0;0
15 15 15 15
-15 -15 -15 -15

Attachments

Change History

comment:1 Changed 14 months ago by shane

  • Description modified (diff)

comment:2 Changed 13 months ago by mark

  • Owner changed from anybody to mark
  • Priority changed from assess to major
  • Xref set to 10207
  • Status changed from new to accepted
  • Milestone changed from UNSCH to 33

overtakes ticket:10207

We were not able to come to consensus, especially coming so close to the release, so will revisit next release.

comment:3 Changed 12 months ago by mark

  • Phase changed from dsub to rc

comment:4 Changed 9 months ago by mark

  • Phase changed from rc to spec-beta

comment:5 Changed 8 months ago by mark

  • Status changed from accepted to design

Whoops, in the ticket queue had thought that this was just documenting an agreement, but it appears that we don't yet have consensus. Pushing to design.

comment:6 Changed 8 months ago by mark

  • Phase changed from spec-beta to dsub
  • Milestone changed from 33 to 34

comment:7 Changed 7 months ago by shane

My recommended behavior, the one in ICU4J 59, will also be the behavior of ICU4C 62 unless I hear otherwise.

comment:8 Changed 7 months ago by mark

  • Keywords google added

Add google keyword: should also add GoogleIssue:XXX if available

comment:9 Changed 6 months ago by mark

  • Phase changed from dsub to rc

comment:10 Changed 6 months ago by pedberg

Agreed in TC that spec should say that "0;0" formats negative value with no sign (ICU4J behavior). Q about "0;"

comment:11 Changed 3 months ago by mark

  • Phase changed from rc to spec-beta

comment:12 Changed 6 weeks ago by mark

  • Status changed from design to accepted

Added:

Note that if an negative subpattern is used as-is: a minus sign is not added, eg "0.00;0.00" ≠ "0.00;-0.00". Trailing semicolons are ignored, eg "0.00;" = "0.00". Whitespace is not ignored, including those around semicolons, so "0.00; -0.00" ≠ "0.00; -0.00".

I believe that is the observed behavior for whitespace, but please check.

comment:13 Changed 6 weeks ago by mark

  • Status changed from accepted to reviewing
  • Review set to shane

comment:14 Changed 6 weeks ago by shane

  • Status changed from reviewing to closed
  • Resolution set to fixed

Confirmed that this is the current ICU behavior.

I added a test for spacing around the semicolon:

https://github.com/unicode-org/icu/pull/184

View

Add a comment

Modify Ticket

Action
as closed
Next status will be 'new'
Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.