| Crates.io | maths_function |
| lib.rs | maths_function |
| version | 0.1.4 |
| created_at | 2023-12-12 09:46:21.03166+00 |
| updated_at | 2023-12-17 10:26:40.337734+00 |
| description | Some maths fuctions |
| homepage | https://github.com/Suns627/My-rust-lib/blob/main/documentation.txt |
| repository | https://github.com/Suns627/My-rust-lib |
| max_upload_size | |
| id | 1066209 |
| size | 2,860 |
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)); }