summary refs log tree commit diff
path: root/src/libcore/num
AgeCommit message (Collapse)AuthorLines
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.
2016-05-13Document the x87 control wordAndrea Canciani-5/+62
Explain the meaning of the fields of the control word and provide more details about how the relevant one (Precision Control) is updated in the fast path.
2016-05-13Fix fast path of float parsing on x87Andrea Canciani-7/+40
The fast path of the float parser relies on the rounding to happen exactly and directly to the correct number of bits. On x87, instead, double rounding would occour as the FPU stack defaults to 80 bits of precision. This can be fixed by setting the precision of the FPU stack before performing the int to float conversion. This can be achieved by changing the value of the x87 control word. This is a somewhat common operation that is in fact performed whenever a float needs to be truncated to an integer, but it is undesirable to add its overhead for code that does not rely on x87 for computations (i.e. on non-x86 architectures, or x86 architectures which perform FPU computations on using SSE). Fixes `num::dec2flt::fast_path_correct` (on x87).
2016-05-08Rollup merge of #33426 - sfackler:try-from, r=aturonManish Goregaokar-1/+94
Implement RFC 1542 cc #33417 r? @aturon
2016-05-07Rollup merge of #33428 - fiveop:wrapping_example, r=steveklabnikSteve Klabnik-0/+11
Add an example to Wrapping's documentation. Such an example would have helped me understand `Wrapping` quicker. r? @steveklabnik
2016-05-07Implement RFC 1542Steven Fackler-1/+94
cc #33417
2016-05-06Auto merge of #33138 - arielb1:sized-shortcut, r=nikomatsakisbors-1/+1
Short-cut `T: Sized` trait selection for ADTs Basically avoids all nested obligations when checking whether an ADT is sized - this speeds up typeck by ~15% The refactoring fixed #32963, but I also want to make `Copy` not object-safe (will commit that soon). Fixes #33201 r? @nikomatsakis
2016-05-05Auto merge of #33067 - notriddle:wrapping_neg, r=alexcrichtonbors-0/+9
Implement negation for wrapping numerals. Fixes #33037
2016-05-05Add an example to Wrapping's documentation.Philipp Matthias Schaefer-0/+11
2016-05-03require the non-last elements of a tuple to be SizedAriel Ben-Yehuda-1/+1
This requirement appears to be missing from RFC1214, but is clearly necessary for translation. The last field of a tuple/enum remains in a state of limbo, compiling but causing an ICE when it is used - we should eventually fix that somehow. this is a [breaking-change] - a soundness fix - and requires a crater run.
2016-04-30Impl int/uint::MIN/MAX in terms of min/max_valueSimonas Kazlauskas-0/+26
2016-04-20Implement negation for wrapping numerals.Michael Howell-0/+9
Fixes #33037
2016-04-17Rollup merge of #33023 - tbu-:pr_wrapping_traits, r=alexcrichtonManish Goregaokar-1/+15
Implement `Display` and `Hash` for `std::num::Wrapping` Also, change the `Debug` implementation to only show the inner value. Fixes #33006.
2016-04-16Implement `Display` and `Hash` for `std::num::Wrapping`Tobias Bucher-1/+15
Also, change the `Debug` implementation to only show the inner value. Fixes #33006.
2016-04-12Remove unused trait importsSeo Sanghyeon-1/+1
2016-04-10Match signed/unsigned integer type docsjethrogb-41/+53
* Copy documentation from signed implementation to unsigned implementation, where necessary. * Use signed integers in signed documentation, where possible.
2016-04-01Fix a couple of dead links on core::num::ParseFloatError docsOliver Middleton-2/+2
2016-03-22try! -> ?Jorge Aparicio-1/+1
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-03-21Auto merge of #32054 - seanmonstar:impl-debug-core, r=alexcrichtonbors-0/+1
libcore: add Debug implementations to most missing types Also adds `#![deny(missing_debug_implementations)]` to the core crate. cc #31869
2016-03-20Update snapshots to 2016-03-18 (235d774).Eduard Burtescu-3/+3
2016-03-20libcore: add Debug implementations to most missing typesSean McArthur-0/+1
2016-03-17Add #[rustc_no_mir] to make tests pass with -Z orbit.Eduard Burtescu-0/+3
2016-03-12std: Clean out deprecated APIsAlex Crichton-176/+1
Removes all unstable and deprecated APIs prior to the 1.8 release. All APIs that are deprecated in the 1.8 release are sticking around for the rest of this cycle. Some notable changes are: * The `dynamic_lib` module was moved into `rustc_back` as the compiler still relies on a few bits and pieces. * The `DebugTuple` formatter now special-cases an empty struct name with only one field to append a trailing comma.
2016-03-11core: Make a new tracking issue for prelude traitsAlex Crichton-3/+3
The referenced issues here were both closed, so hook up a new issue which tracks specifically the prelude traits being unstable.
2016-03-11core: Mark Wrapping impls as stableAlex Crichton-5/+5
These are all insta-stable anyway, so just properly tag them.
2016-03-08doc: Fix a bunch of broken linksAlex Crichton-3/+3
A few categories: * Links into compiler docs were just all removed as we're not generating compiler docs. * Move up one more level to forcibly go to std docs to fix inlined documentation across the facade crates.
2016-03-01Rollup merge of #31965 - miqid:doc, r=steveklabnikSteve Klabnik-10/+10
Hello. Quite a few of the links in the `core` module concerning redirection to additional primitive type documentation are broken. I noticed in #30214 that there seemed to be a consensus with linking across to `std` module documentation from the `core` module. This is what I've done with the `core` modules for primitive types. If the changes here are good to go forward with, I'll happily tend to adding more documentation links for the extension traits in the aforementioned issue if need be. r? @steveklabnik
2016-03-01Fix broken links for core primitivesMichael Huynh-10/+10
Redirects existing links for more details on primitive types in the `core` module to the ones that exist in the `std` module.
2016-02-29std: Stabilize APIs for the 1.8 releaseAlex Crichton-8/+8
This commit is the result of the FCPs ending for the 1.8 release cycle for both the libs and the lang suteams. The full list of changes are: Stabilized * `braced_empty_structs` * `augmented_assignments` * `str::encode_utf16` - renamed from `utf16_units` * `str::EncodeUtf16` - renamed from `Utf16Units` * `Ref::map` * `RefMut::map` * `ptr::drop_in_place` * `time::Instant` * `time::SystemTime` * `{Instant,SystemTime}::now` * `{Instant,SystemTime}::duration_since` - renamed from `duration_from_earlier` * `{Instant,SystemTime}::elapsed` * Various `Add`/`Sub` impls for `Time` and `SystemTime` * `SystemTimeError` * `SystemTimeError::duration` * Various impls for `SystemTimeError` * `UNIX_EPOCH` * `ops::{Add,Sub,Mul,Div,Rem,BitAnd,BitOr,BitXor,Shl,Shr}Assign` Deprecated * Scoped TLS (the `scoped_thread_local!` macro) * `Ref::filter_map` * `RefMut::filter_map` * `RwLockReadGuard::map` * `RwLockWriteGuard::map` * `Condvar::wait_timeout_with` Closes #27714 Closes #27715 Closes #27746 Closes #27748 Closes #27908 Closes #29866
2016-02-26Use .copy_from_slice() where applicableUlrik Sverdrup-2/+2
.copy_from_slice() does the same job of .clone_from_slice(), but the former is explicitly for Copy elements and calls `memcpy` directly, and thus is it efficient without optimization too.
2016-02-15Auto merge of #31663 - nodakai:cleanup-uint_module, r=alexcrichtonbors-7/+7
2016-02-15libcore/num: Remove unused macro argument.NODA, Kai-7/+7
It is no longer necessary after dd0d495f50e2d8ba501e6b003cb4c1ef52d95ed5 Signed-off-by: NODA, Kai <nodakai@gmail.com>
2016-02-14Fix signed int checked_neg docsOliver Middleton-1/+1
2016-02-10Note rotate_{left,right} in wrapping_sh{lr} docsThomas Winwood-0/+14
2016-02-09Some docs for std::numSteve Klabnik-1/+19
This commit does two things: * Re-works the module-level documentation. * Cleaning up wording and adding links to where error types are used. Part of #29364
2016-02-04drive-by doc fixesRobin Kruppe-1/+1