Rational

Type Alias Rational 

Source
pub type Rational = Ratio<i64>;
Expand description

Exact rational number (fraction)

This is an alias for Ratio<i64> from the num_rational crate. All arithmetic operations are exact with no loss of precision.

§Examples

use atlas_embeddings::arithmetic::Rational;

let a = Rational::new(1, 2);  // 1/2
let b = Rational::new(1, 3);  // 1/3
let sum = a + b;              // 5/6 (exact)

assert_eq!(sum, Rational::new(5, 6));

Aliased Type§

pub struct Rational { /* private fields */ }