Function dev_utils::conversion::base_change::src_dec_b10
source · pub fn src_dec_b10(src: &str, src_base: u8) -> f64Expand description
Converts the decimal part of a number from the given source base to base 10.
Arguments
src- A string slice that represents the decimal part of the number to convert.src_base- An unsigned 8-bit integer that represents the source base of the number to convert.
Returns
A float that represents the decimal part of the number in base 10.
Panics
This function will panic if the input string contains an invalid character for the given source base.
Examples
use dev_utils::conversion::base_change::src_dec_b10;
assert_eq!(src_dec_b10("101", 2), 0.625);