Function fraction::division::division_result_max_char_length
source · pub fn division_result_max_char_length<I>(
dividend: &I,
precision: usize,
) -> usizewhere
I: Clone + GenericInteger,
Expand description
Calculate the max possible length of division in characters (including floating point) This may be useful for string/vector pre-allocations
WARNING: Negative numbers as arguments are not supported.
§Examples
use fraction::division::division_result_max_char_length;
assert_eq!(division_result_max_char_length(&1, 0), 1);
assert_eq!(division_result_max_char_length(&10, 0), 2);
assert_eq!(division_result_max_char_length(&10, 1), 4);
assert_eq!(division_result_max_char_length(&100, 2), 6);
assert_eq!(division_result_max_char_length(&900, 2), 6);