4 releases
0.1.3 | Nov 8, 2019 |
---|---|
0.1.2 | Nov 7, 2019 |
0.1.1 | Nov 7, 2019 |
0.1.0 | Nov 7, 2019 |
#2149 in Algorithms
7KB
106 lines
Mathlogic
extern crate mathlogic;
extern crate mathlogic::math;
extern crate mathlogic::weight;
extern crate mathlogic::calculater_int;
extern crate mathlogic::calculater_float;
Math Functions
Power function
let power = mathlogic::math::pow(2, 8);
println!("{}", power);
Square function
let square = mathlogic::math::square(25.4);
println!("Square is {}", square);
Percentage function
let percentage = mathlogic::math::percentage(154.5, 200.0);
println!("Percentage is {}%", percentage);
Fibonacci series function
let a = mathlogic::math::fibonacci(10, 50, 10);
println!("Result => {:?}", a); //This will return result in Vector
Radius of Circle function
let cr = mathlogic::math::circle_radius(20.8);
println!("Radius of Circle is {}", cr);
Calculator for integer value operations
let add = mathlogic::calculate_int::add(10, 20);
let min = mathlogic::calculate_int::min(50, 20);
let div = mathlogic::calculate_int::div(20, 80);
let mul = mathlogic::calculate_int::mul(10, 50);
println!("Result of add is {}", add);
println!("Result of min is {}", min);
println!("Result of div is {}", div);
println!("Result of mul is {}", mul);
Calculator for float value operations
let add = mathlogic::calculate_float::add(10.4, 20.55);
let min = mathlogic::calculate_float::min(50.5, 20.3);
let div = mathlogic::calculate_float::div(20.2, 80.4);
let mul = mathlogic::calculate_float::mul(10.5, 50.6);
println!("Result of add is {}", add);
println!("Result of min is {}", min);
println!("Result of div is {}", div);
println!("Result of mul is {}", mul);
Weight Functions
Lbs to Kgs and Grams
let ltk = mathlogic::weight::lbs_to_kgs(50.5);
println!("Pounds to Kilograms {}", ltk);
let ltg = mathlogic::weight::lbs_to_grms(50.5);
println!("Pounds to Grams {}", ltg);
Kgs to Lbs and Grams
let ktl = mathlogic::weight::kgs_to_lbs(22.906649732377755);
println!("Kilograms to Pounds {}", ktl);
let ktg = mathlogic::weight::kgs_to_grms(150.550);
println!("Kilograms to Grams {}", ktg);
Grams to Lbs and Kgs
let gtl = mathlogic::weight::grms_to_lbs(22.90);
println!("Grams to Pounds {}", gtl);
let gtk = mathlogic::weight::grms_to_kgs(500.255);
println!("Grams to Kilograms {}", gtk);