about summary refs log tree commit diff
path: root/src/libnum/rational.rs
AgeCommit message (Collapse)AuthorLines
2014-10-19Remove a number of deprecated cratesAlex Crichton-803/+0
All of these crates have been deprecated for some time and properly live in the rust-lang organization as cargo-based crates. To update your code, depend on the rust-lang/foo repository via cargo. [breaking-change]
2014-10-03Set the `non_uppercase_statics` lint to warn by defaultP1start-0/+3
2014-09-23Fix regression and overflow bug for rationals.Joseph Crail-5/+44
2014-09-05auto merge of #16775 : jbcrail/rust/fix-rational-docs, r=pcwaltonbors-2/+2
Minor corrections to Rational documentation.
2014-09-02auto merge of #16850 : vks/rust/hash-num, r=alexcrichtonbors-1/+8
Updates #15294.
2014-08-31Fix whitespace and missing parentheses.Joseph Crail-2/+2
2014-08-29num: implement `Hash` for `Complex` and `Ratio`Vinzent Steinberg-1/+8
2014-08-28Fix issue #15826.Joseph Crail-6/+29
The implemented fix rounds half-way cases away from zero as described in the original comments. This rounding algorithm is sometimes called arithmetic rounding. It is described further here: http://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero I also added several new tests to prevent regressions.
2014-08-13core: Change the argument order on splitn and rsplitn for strs.Brian Anderson-2/+2
This makes it consistent with the same functions for slices, and allows the search closure to be specified last. [breaking-change]
2014-07-29Improve documentation of rounding functionsPiotr Jawniak-8/+19
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-1/+2
[breaking-change]
2014-07-05Added num::Signed implementation to Ratio (squashed)Paolo Falabella-0/+44
2014-07-02Rationals that have a 1 denom should print like intsPaolo Falabella-17/+28
2014-06-29Implement RFC#28: Add PartialOrd::partial_cmpSteven Fackler-1/+2
I ended up altering the semantics of Json's PartialOrd implementation. It used to be the case that Null < Null, but I can't think of any reason for an ordering other than the default one so I just switched it over to using the derived implementation. This also fixes broken `PartialOrd` implementations for `Vec` and `TreeMap`. RFC: 0028-partial-cmp
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-9/+9
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-06Change to_str().to_string() to just to_str()Adolfo OchagavĂ­a-1/+1
2014-06-01std: Drop Total from Total{Eq,Ord}Alex Crichton-2/+2
This completes the last stage of the renaming of the comparison hierarchy of traits. This change renames TotalEq to Eq and TotalOrd to Ord. In the future the new Eq/Ord will be filled out with their appropriate methods, but for now this change is purely a renaming change. [breaking-change]
2014-05-30std: Rename {Eq,Ord} to Partial{Eq,Ord}Alex Crichton-12/+12
This is part of the ongoing renaming of the equality traits. See #12517 for more details. All code using Eq/Ord will temporarily need to move to Partial{Eq,Ord} or the Total{Eq,Ord} traits. The Total traits will soon be renamed to {Eq,Ord}. cc #12517 [breaking-change]
2014-05-28std: Remove format_strbuf!()Alex Crichton-3/+3
This was only ever a transitionary macro.
2014-05-27std: Rename strbuf operations to stringRicho Healey-25/+25
[breaking-change]
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-5/+5
[breaking-change]
2014-05-22libcore: Remove all uses of `~str` from `libcore`.Patrick Walton-1/+1
[breaking-change]
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-2/+4
2014-05-15Updates with core::fmt changesAlex Crichton-1/+1
1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used instead. 2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro is preferred wherever possible. 3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.
2014-05-14libnum: Remove all uses of `~str` from `libnum`Patrick Walton-32/+33
2014-04-22auto merge of #13597 : bjz/rust/float-api, r=brsonbors-46/+41
This pull request: - Merges the `Round` trait into the `Float` trait, continuing issue #10387. - Has floating point functions take their parameters by value. - Cleans up the formatting and organisation in the definition and implementations of the `Float` trait. More information on the breaking changes can be found in the commit messages.
2014-04-19Have floating point functions take their parameters by value.Brendan Zabarauskas-6/+6
Make all of the methods in `std::num::Float` take `self` and their other parameters by value. Some of the `Float` methods took their parameters by value, and others took them by reference. This standardises them to one convention. The `Float` trait is intended for the built in IEEE 754 numbers only so we don't have to worry about the trait serving types of larger sizes. [breaking-change]
2014-04-19Merge the Round trait into the Float traitBrendan Zabarauskas-40/+35
Move the rounding functions into the `std::num::Float` trait and then remove `std::num::Round`. This continues the flattening of the numeric traits tracked in #10387. The aim is to make `std::num` very simple and tied to the built in types, leaving the definition of more complex numeric towers to third-party libraries. [breaking-change]
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-23/+23
2014-03-31num: Switch field privacy as necessaryAlex Crichton-2/+2
2014-03-24Correct issue workaround referencesSteven Stewart-Gallus-2/+2
2014-03-23std: remove the `equals` method from `TotalEq`.Huon Wilson-3/+3
`TotalEq` is now just an assertion about the `Eq` impl of a type (i.e. `==` is a total equality if a type implements `TotalEq`) so the extra method is just confusing. Also, a new method magically appeared as a hack to allow deriving to assert that the contents of a struct/enum are also TotalEq, because the deriving infrastructure makes it very hard to do anything but create a trait method. (You didn't hear about this horrible work-around from me :(.)
2014-03-21test: Make manual changes to deal with the fallout from removal ofPatrick Walton-5/+6
`~[T]` in test, libgetopts, compiletest, librustdoc, and libnum.
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-1/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-1/+1
Closes #12771
2014-03-16num: Migrate `~[T]` to `std::vec_ng::Vec`Florian Zeitz-6/+7
2014-02-24Remove std::num::ToStrRadix from the preludeBrendan Zabarauskas-1/+1
2014-02-23Remove all ToStr impls, add Show implsAlex Crichton-3/+4
This commit changes the ToStr trait to: impl<T: fmt::Show> ToStr for T { fn to_str(&self) -> ~str { format!("{}", *self) } } The ToStr trait has been on the chopping block for quite awhile now, and this is the final nail in its coffin. The trait and the corresponding method are not being removed as part of this commit, but rather any implementations of the `ToStr` trait are being forbidden because of the generic impl. The new way to get the `to_str()` method to work is to implement `fmt::Show`. Formatting into a `&mut Writer` (as `format!` does) is much more efficient than `ToStr` when building up large strings. The `ToStr` trait forces many intermediate allocations to be made while the `fmt::Show` trait allows incremental buildup in the same heap allocated buffer. Additionally, the `fmt::Show` trait is much more extensible in terms of interoperation with other `Writer` instances and in more situations. By design the `ToStr` trait requires at least one allocation whereas the `fmt::Show` trait does not require any allocations. Closes #8242 Closes #9806
2014-02-22Move std::num::Integer to libnumBrendan Zabarauskas-0/+2
2014-02-20move extra::test to libtestLiigo Zhuang-2/+1
2014-02-13Removed num::OrderableMichael Darakananda-19/+0
2014-02-11Factoring bigint, rational, and complex out of libextra into libnum.Felix S. Klock II-0/+681
Removed use of globs present in earlier versions of modules. Fix tutorial.md to reflect `extra::rational` ==> `num::rational`.