qtty 0.5.0

Strongly typed physical and astronomical quantities.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Minimal end-to-end example: convert angles and compute a velocity (length / time).

use qtty::velocity::Velocity;
use qtty::{Degrees, Kilometer, Kilometers, Radian, Second, Seconds};

fn main() {
    let a = Degrees::new(180.0);
    let r = a.to::<Radian>();
    assert!((r.value() - core::f64::consts::PI).abs() < 1e-12);

    let d = Kilometers::new(1_000.0);
    let t = Seconds::new(100.0);
    let v: Velocity<Kilometer, Second> = d / t;
    assert!((v.value() - 10.0).abs() < 1e-12);
}