-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What does it mean that a value cannot be represented by Ratio<T>
?
#79
Comments
Hi @Enyium,
sorry, I am not sure what you mean exactly, but ideally the method shouldn't panic. Semantically the method should return None if cannot convert into the relevant type. |
Thanks for the referral. Naturally I must use this crate then. I'm settling the matter with its authors.
I'd like to specify in my API docs when exactly the method
To cite a Reddit comment:
My thought was: Frame rates already become nonsensical after values of 200. A lib user could cap the input, from whereever it's sourced, to, e.g., But since an |
I use this crate to convert an
f64
into an fps value (video framerate) consisting ofu32
numerator and denominator. The documentation forRatio::<u32>::from_f64()
reads:I did a few tests and transformed your explanation into the following doc comment for my
Fps::from_f64()
function:Is that accurate and does it cover everything?
My observations (using pi, shifting the decimal point):
0.0000000000314159
gives menumerator: 0, denominator: 1
.1
. After that, you getNone
.I wondered whether there can be a solution (a fraction) that's so imprecise (not accurately covering enough
f64
digits) that "the value cannot be represented by" theRatio<u32>
?If my description concerning the numerator only is more accurate, maybe your doc comment should also describe it that way to not leave questions open.
The text was updated successfully, but these errors were encountered: