Skip to content

Latest commit

 

History

History

cas-math

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

cas-math

This subcrate provides useful mathematical utilities, such as unit conversion.

Unit conversion

use cas_math::unit_conversion::{Length, Measurement};

let m = Measurement::new(2.0, Length::Mile);
let m2 = m.convert(Length::Decimeter).unwrap();
assert_eq!(m2.value(), &32186.88);

Demo

This repository includes a simple CLI tool to convert units using this library. To run it, run the following command from the root of the repository:

cargo run --package convert-unit-repl

This will start a REPL where you can enter conversion commands. For example:

> 1.5 yd ft
1.5 yd = 4.5 ft