You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using fluent inside the Rust compiler we came across an unfortunate limitation, fluent and more precisely FluentNumber doesn't support the full precision of all numbers it accepts.
This is due to the internal representation of number which uses a f64 which can't fully represent a i64 and u64. For example i64::MAX (9223372036854775807) would be 92233720368547760000, notice the last 4 character 5807 != 0000.
This is particularly a problem for rustc because we print the limits of numbers, which would be off if done using f64. We workaround it using a string for numbers between -100..=100 (to still be able to select on them); but this isn't a solution.
One way I could see fluent fix this issue would be to use a representation like this:
This could probably be solved by using https://docs.rs/fixed_decimal/0.5.5/fixed_decimal as the number representation, which supports arbitrary precision.
Combined with the open PRs to switch to ICU4X for plurals and number formatting, it should also remove the lossy internal conversion from f64 to FixedDecimal.
When using fluent inside the Rust compiler we came across an unfortunate limitation, fluent and more precisely
FluentNumber
doesn't support the full precision of all numbers it accepts.fluent-rs/fluent-bundle/src/types/number.rs
Lines 125 to 129 in a2cef6b
This is due to the internal representation of number which uses a
f64
which can't fully represent ai64
andu64
. For examplei64::MAX
(9223372036854775807) would be 92233720368547760000, notice the last 4 character5807
!=0000
.This is particularly a problem for
rustc
because we print the limits of numbers, which would be off if done usingf64
. We workaround it using a string for numbers between -100..=100 (to still be able to select on them); but this isn't a solution.One way I could see fluent fix this issue would be to use a representation like this:
The text was updated successfully, but these errors were encountered: