zbraniecki / pluralrules

Pluralization handling in Rust
36 stars 4 forks source link

Implement From float specialization for PluralOperands #31

Open zbraniecki opened 4 years ago

zbraniecki commented 4 years ago

Based on the suggestion from https://users.rust-lang.org/u/alice in https://users.rust-lang.org/t/get-fractionals-out-of-f64-as-integer/37559/8

zbraniecki commented 4 years ago

Perf: without: parse_float_operands time: [1.1371 us 1.1428 us 1.1501 us] with: parse_float_operands time: [101.18 ns 101.38 ns 101.62 ns]

zbraniecki commented 4 years ago

@Manishearth - does it look sane to you? Do you think we should keep signed integers in TryFrom, and unsigned/float in From, or would it be ok to move signed integers to From as well (and switch from checked_abs)?

Manishearth commented 4 years ago

Yeah I think it would be fine.

zbraniecki commented 4 years ago

Possible crate to use - https://github.com/Alexhuszagh/rust-lexical/blob/master/README.md#benchmarks