RBNF rule semantics for a ruleset when there is no negative number rule
kipcole9 at gmail.com
Fri Dec 2 03:52:31 CST 2016
I am writing some software using the CLDR. I am stuck on working out the right semantics for formatting a number using RBNF and there is no matching rule within a specified ruleset.
For example (I’m writing this in Elixir but I think the intent is clear) formatting the negative integer -50 in the locale “hr”:
iex> Cldr.Rbnf.Spellout.spellout_ordinal_neuter(-50, "hr”)
returns an error because in the locale “hr”, the ruleset for spellout-ordinal-neuter has the following rules (in 30.0.2, using the json github content):
So that by my understanding, a negative number can’t be formatted in this ruleset for this locale. The nearest understanding I can get is from http://www.icu-project.org/apiref/icu4c/classRuleBasedNumberFormat.html which says:
• If the number is negative, use the negative-number rule.
• If the number has a fractional part and is greater than 1, use the improper fraction rule.
• If the number has a fractional part and is between 0 and 1, use the proper fraction rule.
• Binary-search the rule list for the rule with the highest base value less than or equal to the number. If that rule has two substitutions, its base value is not an even multiple of its divisor, and the number is an even multiple of the rule's divisor, use the rule that precedes it in the rule list. Otherwise, use the rule itself.
Given a negative integer in this context then:
1. There is no negative number rule
2. There is no rule that satisfies "Binary-search the rule list for the rule with the highest base value less than or equal to the number.”
Are then any additional semantics intended to cover this case or is an error the appropriate response?
More information about the CLDR-Users