Skip to content

Floor and Ceil overflow too easily #143

@mikem8891

Description

@mikem8891

The floor and ceil functions overflow too easily. Below is an example:

use num_rational::Ratio; // 0.4.2

fn main() {
    let frac = Ratio::<i8>::new(70, 81);
    println!("ceil({frac}) = ");
    println!("{}", frac.ceil());
}

Unrelated: It seems odd that there are several functions that return integers as Ratio<T> instead of the T.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions