num-notation 0.1.6

Offers multiple numeric choices, allowing you to work with various number representations including StandardForm, fractions, and f64 floating-point decimals. This versatile crate empowers your Rust projects with flexible numeric handling.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::hash::{Hash, Hasher};
use ordered_float::OrderedFloat;

use crate::Number;

impl Hash for Number { 
    fn hash<H>(&self, state: &mut H) where H: Hasher {
        use Number::*;
        match self {
            Decimal(float) => OrderedFloat(*float).hash(state),
            StandardForm(sf) => (*sf).hash(state),
            Fraction(fr) => fr.hash(state)
        }
    }
}