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
Add From for f64 and f32 #98
Comments
Hi @feefladder, Thanks for raising this. |
The conversion would also need a match statement for ±infty and Nan. I would argue that floats are lossy by definition and converting the conceptual value of a fraction to a float means acceptig lossy conversions/operations; From the perspective of the fraction it is lossy, but from the perspective of the float it is lossless: f64::from(1/3) gives the best possible float representation. Aka Maybe as a feature called Okok. Just realized that bigint frac could overflow f64, but thats not the type I'm asking here :) |
I agree, there could be specific lossy features that make a a lot of sense and would help :) |
Hey there! I know beggars can't be choosers, but I find this crate to be way less useful without this kind of abstraction. It doesn't feel good to spin this yourself - reminds me of C... 😭 In my view, there should at least be a feature-flag'd submodule with Are there any implementation barriers you see for this kind of thing? If someone were to implement it, what would you want to see? And would you accept a PR? Thanks for the useful crate! I hope to see it continue to improve. 😄 |
Hi @onkoe, |
It would be nice to have api for directly converting to floats, since conversion cannot fail (as far as I know)
The text was updated successfully, but these errors were encountered: