icu4x icon indicating copy to clipboard operation
icu4x copied to clipboard

Develop Sign, Unsign, Nan & Inf for FixedDecimal

Open younies opened this issue 1 month ago • 3 comments

In many application for units (especially, mixed units), There are a need to represent the numbers as Inf, Neg, Pos ... etc.

Examples:

  1. 3 feet, and 11 inches --> could not be 3 feet and -11 inches
  2. 5:03:04 --> could not be 5:-03:+04
  3. Inf L/100-km
  4. ... etc.

Therefore, we need a way to represent Inf, Neg, Nan ... etc in FixedDecimal

Options for expressing mixed units:

  1. List of FixedUnsignedDecimal
    1. New type; FixedDecimal contains it as an inner field
    2. FixedDecimal gets a generic parameter
    3. Compositional fixed decimal types, like Signed<T>
  2. List of FixedDecimal, take absolute value of each before formatting
  3. List of FixedDecimal, show sign when formatting: 3 feet, -11 inches

younies avatar Jun 15 '24 15:06 younies