summary refs log tree commit diff
path: root/src/libcore/num
AgeCommit message (Collapse)AuthorLines
2017-04-20Remove float_extrasJosh Stone-150/+36
[unstable, deprecated since 1.11.0]
2017-04-20Remove num::{Zero,One}Josh Stone-72/+0
[unstable, deprecated since 1.11.0]
2017-04-14Use associated constants in core::num::dec2fltRobin Kruppe-152/+98
2017-04-05Rollup merge of #41037 - stjepang:move-libxtest, r=alexcrichtonCorey Farwell-4/+4
Move libXtest into libX/tests This change moves: 1. `libcoretest` into `libcore/tests` 2. `libcollectionstest` into `libcollections/tests` This is a follow-up to #39561. r? @alexcrichton
2017-04-03Replace ^ with <sup> html baliseGuillaume Gomez-6/+7
2017-04-03Move libXtest into libX/testsStjepan Glavina-4/+4
This change moves: 1. `libcoretest` into `libcore/tests` 2. `libcollectionstest` into `libcollections/tests` This is a follow-up to #39561.
2017-03-25Fix typo in dec2flt/algorithm.rsIrfan Hudda-2/+2
2017-03-22Various fixes to wording consistency in the docsStjepan Glavina-7/+7
2017-03-19Rollup merge of #40521 - TimNN:panic-free-shift, r=alexcrichtonCorey Farwell-18/+99
Implemente overflowing_sh* with new unchecked_sh* intrinsics Also update some 128 bit builtins to not rely on the constant evaluator to avoid checked operations. Fixes #40508. cc @nagisa, @alexcrichton Note: I still have a build running to see if the 128 bit changes worked (unoptimized builds take *forever* to compile), however at least the overflowing builtins no longer reference `core::panicking::panic`.
2017-03-19Rollup merge of #40281 - jimmycuadra:try-from-from-str, r=aturonCorey Farwell-3/+3
Rename TryFrom's associated type and implement str::parse using TryFrom. Per discussion on the tracking issue, naming `TryFrom`'s associated type `Error` is generally more consistent with similar traits in the Rust ecosystem, and what people seem to assume it should be called. It also helps disambiguate from `Result::Err`, the most common "Err". See https://github.com/rust-lang/rust/issues/33417#issuecomment-269108968. `TryFrom<&str>` and `FromStr` are equivalent, so have the latter provide the former to ensure that. Using `TryFrom` in the implementation of `str::parse` means types that implement either trait can use it. When we're ready to stabilize `TryFrom`, we should update `FromStr` to suggest implementing `TryFrom<&str>` instead for new code. See https://github.com/rust-lang/rust/issues/33417#issuecomment-277175994 and https://github.com/rust-lang/rust/issues/33417#issuecomment-277253827. Refs #33417.
2017-03-18add inline attributes to stage 0 methodsTim Neumann-0/+4
2017-03-15Rename TryFrom's associated type and implement str::parse using TryFrom.Jimmy Cuadra-3/+3
Per discussion on the tracking issue, naming `TryFrom`'s associated type `Error` is generally more consistent with similar traits in the Rust ecosystem, and what people seem to assume it should be called. It also helps disambiguate from `Result::Err`, the most common "Err". See https://github.com/rust-lang/rust/issues/33417#issuecomment-269108968. TryFrom<&str> and FromStr are equivalent, so have the latter provide the former to ensure that. Using TryFrom in the implementation of `str::parse` means types that implement either trait can use it. When we're ready to stabilize `TryFrom`, we should update `FromStr` to suggest implementing `TryFrom<&str>` instead for new code. See https://github.com/rust-lang/rust/issues/33417#issuecomment-277175994 and https://github.com/rust-lang/rust/issues/33417#issuecomment-277253827. Refs #33417.
2017-03-15make shift builtins panic-free with new unchecked_sh* intrinsicsTim Neumann-18/+95
Also update some 128 bit builtins to be panic-free without relying on the const evaluator.
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-5/+5
This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-02-05Auto merge of #39408 - ollie27:i128_try_from, r=alexcrichtonbors-4/+4
Fix TryFrom for i128/u128 Another case of `as` cast silent truncation being error prone. This also adds a few missing TryFrom tests to libcoretest. cc #33417 cc #35118
2017-02-05Rollup merge of #39393 - ollie27:stab_impls, r=alexcrichtonCorey Farwell-16/+26
Fix a few impl stability attributes The versions show up in rustdoc.
2017-02-04Fix TryFrom for i128/u128Oliver Middleton-4/+4
Another case of `as` cast silent truncation being error prone. This also adds a few missing TryFrom tests to libcoretest.
2017-02-03Bump version, upgrade bootstrapAlex Crichton-78/+4
This commit updates the version number to 1.17.0 as we're not on that version of the nightly compiler, and at the same time this updates src/stage0.txt to bootstrap from freshly minted beta compiler and beta Cargo.
2017-01-29Fix a few impl stability attributesOliver Middleton-16/+26
The versions show up in rustdoc.
2017-01-06Make members of {std,core}::{i128,u128} unstableest31-24/+26
Adding it in a stable form was an accident. It thankfully only leaked to nightly. Fixes #38860
2016-12-30Fix rebase falloutest31-0/+21
2016-12-30Wrapping<i128> and attempt at LLVM 3.7 compatSimonas Kazlauskas-0/+2
This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-34/+143
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-10-23Implement ops on `&Wrapping<T>`Cristi Cobzarenco-0/+10
2016-10-12run rustfmt on libcore/num folderSrinivas Reddy Thatiparthy-54/+112
2016-10-07rewrite checked_{div,rem} to no contain any reference to panicsJorge Aparicio-8/+6
even without optimizations
2016-10-04Rollup merge of #36902 - ollie27:stab_impls, r=alexcrichtonManish Goregaokar-7/+7
std: Correct stability attributes for some implementations These are displayed by rustdoc so should be correct.
2016-10-03std: Stabilize and deprecate APIs for 1.13Alex Crichton-9/+3
This commit is intended to be backported to the 1.13 branch, and works with the following APIs: Stabilized * `i32::checked_abs` * `i32::wrapping_abs` * `i32::overflowing_abs` * `RefCell::try_borrow` * `RefCell::try_borrow_mut` * `DefaultHasher` * `DefaultHasher::new` * `DefaultHasher::default` Deprecated * `BinaryHeap::push_pop` * `BinaryHeap::replace` * `SipHash13` * `SipHash24` * `SipHasher` - use `DefaultHasher` instead in the `std::collections::hash_map` module Closes #28147 Closes #34767 Closes #35057 Closes #35070
2016-10-01std: Correct stability attributes for some implementationsOliver Middleton-7/+7
These are displayed by rustdoc so should be correct.
2016-09-22Rollup merge of #36423 - GuillaumeGomez:eq_impl, r=pnkfelixJonathan Turner-7/+7
Add missing Eq implementations Part of #36301.
2016-09-19Auto merge of #34942 - porglezomp:master, r=sfacklerbors-15/+11
Fix overflow checking in unsigned pow() The pow() method for unsigned integers produced 0 instead of trapping overflow for certain inputs. Calls such as 2u32.pow(1024) produced 0 when they should trap an overflow. This also adds tests for the correctly handling overflow in unsigned pow(). This was previously fixed for signed integers in #28248, but it seems unsigned integers got missed that time. For issue number #34913
2016-09-18Add missing Eq implementationsGuillaume Gomez-7/+7
2016-09-11Use question_mark feature in libcore.Ahmed Charles-2/+2
2016-08-24Use `#[prelude_import]` in `libcore`.Jeffrey Seyfried-24/+2
2016-08-06Fix overflow checking in unsigned pow()Caleb Jones-15/+11
The pow() method for unsigned integers produced 0 instead of trapping overflow for certain inputs. Calls such as 2u32.pow(1024) produced 0 when they should trap an overflow. This also adds tests for the correctly handling overflow in unsigned pow(). For issue number #34913
2016-07-28Add non-panicking abs() functions to all signed integer types.Jethro Beekman-0/+84
Currently, calling abs() on one of the signed integer types might panic (in debug mode at least) because the absolute value of the largest negative value can not be represented in that signed type. Unlike all other integer operations, there is currently not a non-panicking version on this function. This seems to just be an oversight in the design, therefore just adding it now.
2016-07-15Improve float number exampleGuillaume Gomez-1/+1
2016-07-13Add examples for FpCategoryggomez-5/+24
2016-07-08Improve primitive integers documentationGuillaume Gomez-0/+32
2016-07-06Rollup merge of #34277 - ollie27:docs_num, r=steveklabnikSteve Klabnik-65/+64
Add/improve num const docs This adds short summaries to all num consts. r? @steveklabnik
2016-07-03std: Stabilize APIs for the 1.11.0 releaseAlex Crichton-34/+90
Although the set of APIs being stabilized this release is relatively small, the trains keep going! Listed below are the APIs in the standard library which have either transitioned from unstable to stable or those from unstable to deprecated. Stable * `BTreeMap::{append, split_off}` * `BTreeSet::{append, split_off}` * `Cell::get_mut` * `RefCell::get_mut` * `BinaryHeap::append` * `{f32, f64}::{to_degrees, to_radians}` - libcore stabilizations mirroring past libstd stabilizations * `Iterator::sum` * `Iterator::product` Deprecated * `{f32, f64}::next_after` * `{f32, f64}::integer_decode` * `{f32, f64}::ldexp` * `{f32, f64}::frexp` * `num::One` * `num::Zero` Added APIs (all unstable) * `iter::Sum` * `iter::Product` * `iter::Step` - a few methods were added to accomodate deprecation of One/Zero Removed APIs * `From<Range<T>> for RangeInclusive<T>` - everything about `RangeInclusive` is unstable Closes #27739 Closes #27752 Closes #32526 Closes #33444 Closes #34152 cc #34529 (new tracking issue)
2016-06-30Correct MIN_EXP docs and improve EPSILONOliver Middleton-4/+4
2016-06-14Add/improve num const docsOliver Middleton-65/+64
This adds short summaries to all num consts.
2016-06-09Implement Binary, Octal, LowerHex and UpperHex for Wrapping<T>Oliver Middleton-0/+28
2016-06-05core: mark relevant functions with #[rustc_inherit_overflow_checks].Eduard Burtescu-3/+3
2016-06-03Auto merge of #33460 - shepmaster:16-bit-pointers, r=Aatchbors-0/+31
Support 16-bit pointers as well as i/usize I'm opening this pull request to get some feedback from the community. Although Rust doesn't support any platforms with a native 16-bit pointer at the moment, the [AVR-Rust][ar] fork is working towards that goal. Keeping this forked logic up-to-date with the changes in master has been onerous so I'd like to merge these changes so that they get carried along when refactoring happens. I do not believe this should increase the maintenance burden. This is based on the original work of Dylan McKay (@dylanmckay). [ar]: https://github.com/avr-rust/rust
2016-05-31mk: Prepare for a new stage0 compilerAlex Crichton-31/+0
This commit prepares the source for a new stage0 compiler, the 1.10.0 beta compiler. These artifacts are hot off the bots and should be ready to go.
2016-05-19Support 16-bit pointers as well as i/usizeJake Goulding-0/+31
This is based on the original work of Dylan McKay for the [avr-rust project][ar]. [ar]: https://github.com/avr-rust/rust
2016-05-16Fix `asm!` blocksAndrea Canciani-2/+2
The `volatile` modifier was incorrectly written outside of the `asm!` blocks.
2016-05-16Cleanup documentationAndrea Canciani-31/+10
Remove irrelevant information (and instead provide pointer to reference documentation), replace ASCII-art table with the corresponding MarkDown one, and minor fixes.