Use sensible maths for `from_rational` (#13660)
* Use sensible maths for from_rational * Fixes * Fixes * More fixes * Remove debugging * Add fuzzer tests Signed-off-by:Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Prevent panics Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * docs Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Clean up old code Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Test all rounding modes of from_rational Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Clean up code Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Revert "Prevent panics" This reverts commit 7e88ac76138a1b590e68b68318505b69efe1e1f6. * fix imports Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * cleanup Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fuzz test multiply_rational Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix import Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fmt Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Return None in multiply_rational on zero div Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> --------- Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Showing
- substrate/Cargo.lock 40 additions, 2 deletionssubstrate/Cargo.lock
- substrate/frame/staking/src/tests.rs 4 additions, 4 deletionssubstrate/frame/staking/src/tests.rs
- substrate/primitives/arithmetic/fuzzer/Cargo.toml 9 additions, 2 deletionssubstrate/primitives/arithmetic/fuzzer/Cargo.toml
- substrate/primitives/arithmetic/fuzzer/src/multiply_by_rational_with_rounding.rs 63 additions, 36 deletions...ithmetic/fuzzer/src/multiply_by_rational_with_rounding.rs
- substrate/primitives/arithmetic/fuzzer/src/per_thing_from_rational.rs 105 additions, 0 deletions...imitives/arithmetic/fuzzer/src/per_thing_from_rational.rs
- substrate/primitives/arithmetic/fuzzer/src/per_thing_mult_fraction.rs 69 additions, 0 deletions...imitives/arithmetic/fuzzer/src/per_thing_mult_fraction.rs
- substrate/primitives/arithmetic/fuzzer/src/per_thing_rational.rs 0 additions, 116 deletions...te/primitives/arithmetic/fuzzer/src/per_thing_rational.rs
- substrate/primitives/arithmetic/src/helpers_128bit.rs 2 additions, 2 deletionssubstrate/primitives/arithmetic/src/helpers_128bit.rs
- substrate/primitives/arithmetic/src/lib.rs 1 addition, 1 deletionsubstrate/primitives/arithmetic/src/lib.rs
- substrate/primitives/arithmetic/src/per_things.rs 27 additions, 62 deletionssubstrate/primitives/arithmetic/src/per_things.rs
- substrate/primitives/arithmetic/src/rational.rs 48 additions, 0 deletionssubstrate/primitives/arithmetic/src/rational.rs
- substrate/primitives/arithmetic/src/traits.rs 4 additions, 2 deletionssubstrate/primitives/arithmetic/src/traits.rs
Please register or sign in to comment