#infinity #arithmetic #numbers #arithmetic-operations #no-alloc

no-std intfinity

An abstraction over numeric types with infinity implemented

8 unstable releases (3 breaking)

0.4.0 Dec 16, 2024
0.3.3 Sep 29, 2024
0.2.2 Sep 4, 2024
0.1.0 Sep 3, 2024

#1128 in Math

Download history 451/week @ 2024-09-02 5/week @ 2024-09-16 177/week @ 2024-09-23 130/week @ 2024-09-30 15/week @ 2024-10-07 5/week @ 2024-10-14 9/week @ 2024-12-09 127/week @ 2024-12-16

136 downloads per month

Custom license

19KB
497 lines

intfinity

Rust crate that provides a generic type for representing and working with both finite and infinite numeric values. It supports operations that automatically handle overflow and underflow, mapping them to positive or negative infinity as appropriate.

Getting Started

Add intfinity to your Cargo.toml:

[dependencies]
intfinity = "0.4.0"

Example Usage

use intfinity::int;

fn main() {
    let a = int::new(42);
    let b = int::posinf;
    
    let result = a + b;
    
    assert_eq!(result, int::posinf);
}

License

This project is under the MIT license.

No runtime deps