Function googology::conway_wechsler::power_of_ten[][src]

pub fn power_of_ten(digits: &str, scale: Scale) -> Result<String, ParseError>

Gives a name for a number representing a power of ten. This function is equivalent to using full_name with a one followed by as many zeroes as would be indicated the number described by digits.

Arguments

  • digits - A string slice that holds a representation of the number using only the digits 0-9. If any other character is present, this function will return an Err.
  • scale - An enumerated value to determine which scale should be used. Short scales use a new “-illion” name for every power of 1000, while long scales use a new “-illion” name for every power of 1000000.

Example

use googology::conway_wechsler::{Scale, power_of_ten};
let thousand_million = power_of_ten("9", Scale::LongBritish).unwrap();
let billion = power_of_ten("9", Scale::Short).unwrap();
assert_eq!("one thousand million", thousand_million.as_str());
assert_eq!("one billion", billion.as_str());