6 releases
0.1.4 | Dec 17, 2023 |
---|---|
0.1.3 | Dec 17, 2023 |
0.0.5 | Dec 12, 2023 |
#603 in Math
43 downloads per month
3KB
There are some easy math fuction,there are add...... You can use the add function too add,and use subtract...... There is code: pub mod math_functions { pub fn add(a: i32, b: i32) -> i32 { a + b } pub fn subtract(a: i32, b: i32) -> i32 { a - b } pub fn multiply(a: i32, b: i32) -> i32 { a * b } pub fn divide(a: i32, b: i32) -> Result<i32, &'static str> { if b == 0 { Err("Cannot divide by zero") } else { Ok(a / b) } } }
And use distance: fn main(){ let ax: i32 = ......; let ...... ...... println!("{}",distance(ax,ay,bx,by)); }