Hi,
Thanks for all updates. I started replacing CLDR in my app for testing and got a few more points.
The first one:
A question rather than a bug report. On main @ a28da2f, convert/2 preserves Decimal values (thanks for that fix in rc.3) but returns floats for integer-valued units:
{:ok, u} = Localize.Unit.new(1, "tonne") # value: 1 (integer)
{:ok, c} = Localize.Unit.convert(u, "kilogram")
c.value #=> 1000.0 (float)
{:ok, u2} = Localize.Unit.new(Decimal.new(1), "tonne")
{:ok, c2} = Localize.Unit.convert(u2, "kilogram")
c2.value #=> Decimal — exact
I can see the case for floats in a display-oriented library but the Decimal fix suggests a different principle: input type governs output type. What is the intented value-type contract?
Thank you in advance
Hi,
Thanks for all updates. I started replacing CLDR in my app for testing and got a few more points.
The first one:
A question rather than a bug report. On main @ a28da2f,
convert/2preserves Decimal values (thanks for that fix in rc.3) but returns floats for integer-valued units:I can see the case for floats in a display-oriented library but the Decimal fix suggests a different principle: input type governs output type. What is the intented value-type contract?
Thank you in advance