Uh oh!
There was an error while loading. Please reload this page.
Reform rational - #6471
Conversation
huonw
commented
May 14, 2013
My reasoning for |
This allows creating `Ratio<T>` which `T` is non-implicitly copyable types such as `BigInt`.
gifnksm
commented
May 14, 2013
huonw
commented
May 14, 2013
Cool! (Nice clean-up.) |
huonw
commented
May 14, 2013
Actually thinking about it a bit more, it would be better to use the gcd implementation on the Integer trait than to have the one in the rational.rs. (Since the performance of the type-specific one will presumably be much better.) So I think that the |
gifnksm
commented
May 14, 2013
@huonw It is correct in the performance sense, but it is strange in the naming convention sense (polynomials is For now, in this pull request, using |
huonw
commented
May 14, 2013
I agree about the naming, but names are always hard, and I added a note to #4819. (I don't have magical r+ powers, by the way.) |
gifnksm
commented
May 14, 2013
Oh, I didn't know you don't have the power, sorry. |
`std::ratio` module contains `BigRational` type, but the type is not usable by following reasons. * `Ratio::new` requires `T: Copy + Num + Ord`, but `BigInt` is not implicitly copyable, because it contains unique vector. * `BigInt` is not implements `Num` So, I rewrite `Ratio` as follows. * `Ratio` requires `T: Clone + Integer + Ord`. * `Copy` -> `Clone`: to be able to use `BigRational` * `Num` -> `Integer`: It is incorrect that a rational number constructed by two non-integer numbers. * `BigInt` implements `Num` and `Orderable` which are required by `Integer` bound
Fix blessing of new reference files Adding of new reference files wasn't handled correctly. It was trying to read a file that didn't exist yet. Instead of unwrapping, we now treat a missing reference file as empty (`Vec::new`). This makes the following conditional work. We then also have to re-read the reference file after it was being copied. This second read is technically the same as in the old shell script, but wasn't really obvious there. The shell script did a `-s` test which reads the file as well. changelog: internal: Fix `cargo dev bless` when new reference files are added
6471: cargo update r=kjeremy a=kjeremy Co-authored-by: kjeremy <kjeremy@gmail.com>
std::ratiomodule containsBigRationaltype, but the type is not usable by following reasons.Ratio::newrequiresT: Copy + Num + Ord, butBigIntis not implicitly copyable, because it contains unique vector.BigIntis not implementsNumSo, I rewrite
Ratioas follows.RatiorequiresT: Clone + Integer + Ord.Copy->Clone: to be able to useBigRationalNum->Integer: It is incorrect that a rational number constructed by two non-integer numbers.BigIntimplementsNumandOrderablewhich are required byIntegerbound