Skip to content

Feature request: Limiting precision #99

@ijustlovemath

Description

@ijustlovemath

I'm using this library to losslessly model orbits in an n-body simulator, and I've noticed that after just a few iterations, the length of the data field seems to be growing quite rapidly; quadratically or exponentially is my guess. It would be useful to be able to do something like:

let mut n = Ratio::from_float(1.0).unwrap();
n.max_precision(20); // maximum number of digits in either numerator or denominator is now 20, lossy approximations afterwards

You could implement this using Farey fractions, see here: https://math.stackexchange.com/questions/2438510/can-i-find-the-closest-rational-to-any-given-real-if-i-assume-that-the-denomina

I may also just be unfamiliar with the API and don't see where this option exists

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