A small arithmetic library + CLI for basic calculations (sum, subtract, multiply, divide) supporting floats.
As a binary (non-interactive):
cargo run -- sum 1.5 2.25
# -> 3.75
cargo run -- multiply 2 3 4
# -> 24As a library:
[dependencies]
count_cli = "0.1"use count_cli::ops;
let s = ops::calculate_sum("1.2 3.4");
println!("{}", s);Run cargo run with no arguments and follow the prompts.
There's a small example binary under examples/cli.rs. Build and run it with:
cargo run --example cli -- 1 2 3
# -> prints sum and product- Input tokens that cannot be parsed as numbers are ignored.
- Division returns an error message when dividing by zero or on empty input.
- All calculations use floating-point (
f64).
Dual-licensed under MIT OR Apache-2.0. See the LICENSE file.