summary refs log tree commit diff
path: root/src/libstd/num
AgeCommit message (Collapse)AuthorLines
2014-01-07Fix remaining cases of leaking importsAlex Crichton-0/+2
2014-01-07std: Fill in all missing importsAlex Crichton-1/+1
Fallout from the previous commits
2014-01-06Remove some unnecessary type castsFlorian Hahn-1/+1
Conflicts: src/librustc/middle/lint.rs
2014-01-03libstd: Remove all support code related to `@mut`Patrick Walton-5/+0
2013-12-27std: uniform modules titles for docLuca Bruno-13/+15
This commit uniforms the short title of modules provided by libstd, in order to make their roles more explicit when glancing at the index. Signed-off-by: Luca Bruno <lucab@debian.org>
2013-12-23std: Fix all code examplesAlex Crichton-13/+18
2013-12-15std: fix spelling in docs.Huon Wilson-2/+2
2013-12-14Dead-code pass now marks and warns foreign itemsKiet Tran-0/+1
2013-12-08Remove dead codesKiet Tran-17/+17
2013-12-05Fix documentation typo (divison operator is not backslash)Alexandros Tasos-2/+2
2013-12-04auto merge of #10803 : vmx/rust/integer-decode, r=cmrbors-0/+60
The `integer_decode()` function decodes a float (f32/f64) into integers containing the mantissa, exponent and sign. It's needed for `rationalize()` implementation of #9838. The code got ported from ABCL [1]. [1] http://abcl.org/trac/browser/trunk/abcl/src/org/armedbear/lisp/FloatFunctions.java?rev=14465#L94 I got the permission to use this code for Rust from Peter Graves (the ABCL copyright holder) . If there's any further IP clearance needed, let me know.
2013-12-04Decode a float into integersVolker Mische-0/+60
The `integer_decode()` function decodes a float (f32/f64) into integers containing the mantissa, exponent and sign. It's needed for `rationalize()` implementation of #9838. The code got ported from ABCL [1]. [1] http://abcl.org/trac/browser/trunk/abcl/src/org/armedbear/lisp/FloatFunctions.java?rev=14465#L94
2013-12-04std::str: remove from_utf8.Huon Wilson-1/+1
This function had type &[u8] -> ~str, i.e. it allocates a string internally, even though the non-allocating version that take &[u8] -> &str and ~[u8] -> ~str are all that is necessary in most circumstances.
2013-11-29Removed module macro workaround for signed and unsigned integersMarvin Löbel-57/+93
2013-11-29Removed useless cmp::{min, max} reexports from the integer modulesMarvin Löbel-4/+0
2013-11-29Removed a few macro-expanding-to-module workaroundsMarvin Löbel-42/+32
Also documented a few issues
2013-11-26libstd: Fix Win32 and other bustage.Patrick Walton-3/+3
2013-11-26test: Remove non-procedure uses of `do` from compiletest, libstd tests,Patrick Walton-5/+5
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-8/+8
2013-11-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-7/+17
2013-11-11Use constants instead of raw values.Jay Anderson-4/+2
2013-11-11Got directions backwards in to_degrees and to_radians docs.Jay Anderson-2/+2
2013-11-11Add docs for traits Exponential, Hyperbolic, BitCount.Jay Anderson-2/+44
2013-11-11Update docs for Fractional, Algebraic, Round, and Trigonometric traits.Jay Anderson-0/+89
2013-11-11Remove #[fixed_stack_segment] and #[rust_stack]Alex Crichton-2/+2
These two attributes are no longer useful now that Rust has decided to leave segmented stacks behind. It is assumed that the rust task's stack is always large enough to make an FFI call (due to the stack being very large). There's always the case of stack overflow, however, to consider. This does not change the behavior of stack overflow in Rust. This is still normally triggered by the __morestack function and aborts the whole process. C stack overflow will continue to corrupt the stack, however (as it did before this commit as well). The future improvement of a guard page at the end of every rust stack is still unimplemented and is intended to be the mechanism through which we attempt to detect C stack overflow. Closes #8822 Closes #10155
2013-11-03Rename files to match current recommendations.Chris Morgan-0/+0
New standards have arisen in recent months, mostly for the use of rustpkg, but the main Rust codebase has not been altered to match these new specifications. This changeset rectifies most of these issues. - Renamed the crate source files `src/libX/X.rs` to `lib.rs`, for consistency with current styles; this affects extra, rustc, rustdoc, rustpkg, rustuv, std, syntax. - Renamed `X/X.rs` to `X/mod.rs,` as is now recommended style, for `std::num` and `std::terminfo`. - Shifted `src/libstd/str/ascii.rs` out of the otherwise unused `str` directory, to be consistent with its import path of `std::ascii`; libstd is flat at present so it's more appropriate thus. While this removes some `#[path = "..."]` directives, it does not remove all of them, and leaves certain other inconsistencies, such as `std::u8` et al. which are actually stored in `src/libstd/num/` (one subdirectory down). No quorum has been reached on this issue, so I felt it best to leave them all alone at present. #9208 deals with the possibility of making libstd more hierarchical (such as changing the crate to match the current filesystem structure, which would make the module path `std::num::u8`). There is one thing remaining in which this repository is not rustpkg-compliant: rustpkg would have `src/std/` et al. rather than `src/libstd/` et al. I have not endeavoured to change that at this point as it would guarantee prompt bitrot and confusion. A change of that magnitude needs to be discussed first.
2013-10-30auto merge of #9613 : jld/rust/enum-discrim-size.r0, r=alexcrichtonbors-1/+2
Allows an enum with a discriminant to use any of the primitive integer types to store it. By default the smallest usable type is chosen, but this can be overridden with an attribute: `#[repr(int)]` etc., or `#[repr(C)]` to match the target's C ABI for the equivalent C enum. Also adds a lint pass for using non-FFI safe enums in extern declarations, checks that specified discriminants can be stored in the specified type if any, and fixes assorted code that was assuming int.
2013-10-29Work around const_eval issues by changing signed integer `min_value`s.Jed Davis-1/+2
Otherwise, run-pass/deriving-primitive.rs breaks on 32-bit platforms, because `int::min_value` is `0xffffffff7fffffff` when evaluated for the discriminant declaration.
2013-10-28Capitalize statics in f32 and f64 modsZiad Hatahet-146/+142
Fixes #10077
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-7/+7
Who doesn't like a massive renaming?
2013-10-17std: Move size/align functions to std::mem. #2240Brian Anderson-15/+15
2013-10-16Fixed example comment for num::cast().Ziad Hatahet-1/+1
2013-10-16Added comments to public functions in num.rs.Vijay Korapaty-2/+70
Copied existing comments from other files, and added comments to functions that did not have existing comments available.
2013-10-14Removing ccdeclSteve Klabnik-2/+2
as per https://github.com/mozilla/rust/pull/9606#discussion_r6930872
2013-10-14Remove unused abi attributes.Steve Klabnik-4/+2
They've been replaced by putting the name on the extern block. #[abi = "foo"] goes to extern "foo" { } Closes #9483.
2013-10-08Fix float to float ToPrimitive implementation.Sébastien Crozet-2/+1
The mimimum (negative) value of a float is -Bounded::max_value(), not Bounded::min_value().
2013-10-08auto merge of #9757 : erickt/rust/master, r=alexcrichtonbors-3/+48
I accidentally left an infinite loop in a default method in `num::ToPrimitive::to_u64()`. This fixes it.
2013-10-07std: fix an infinite loop in num::ToPrimitive and add testsErick Tryzelaar-3/+48
2013-10-07Fix existing privacy/visibility violationsAlex Crichton-2/+2
This commit fixes all of the fallout of the previous commit which is an attempt to refine privacy. There were a few unfortunate leaks which now must be plugged, and the most horrible one is the current `shouldnt_be_public` module now inside `std::rt`. I think that this either needs a slight reorganization of the runtime, or otherwise it needs to just wait for the external users of these modules to get replaced with their `rt` implementations. Other fixes involve making things pub which should be pub, and otherwise updating error messages that now reference privacy instead of referencing an "unresolved name" (yay!).
2013-10-05std: add Primitive.is_signedErick Tryzelaar-0/+13
2013-10-05std: ToPrimitive's default impls should use `.to_*()`Erick Tryzelaar-22/+11
This allows the default methods to be properly range checked.
2013-10-05std: fix some warningsErick Tryzelaar-5/+0
2013-10-05std: check bounds for ints/uints in {To,From}PrimitiveErick Tryzelaar-60/+598
2013-10-02std: Swap {To,From}Primitive to use the 64bit as the unimplemented versionErick Tryzelaar-32/+36
One downside with this current implementation is that since BigInt's default is now 64 bit, we can convert larger BigInt's to a primitive, however the current implementation on 32 bit architectures does not take advantage of this fact.
2013-10-02std: Replace num::IntConvertible with {To,From}PrimitiveErick Tryzelaar-96/+354
2013-10-02auto merge of #9665 : alexcrichton/rust/snapshot, r=brsonbors-1/+1
Uses the new snapshots to kill the old `loop` and introduce the new `continue`.
2013-10-02auto merge of #9638 : ↵bors-0/+2
pnkfelix/rust/fsk-issue7526-attempt-to-catch-nonuc-statics-in-match-patterns, r=alexcrichton r? anyone Address scariest part of #7526 by adding a new more specific lint (that is set to warn by default, rather than allow).
2013-10-01Migrate users of 'loop' to 'continue'Alex Crichton-1/+1
Closes #9467
2013-10-01remove the `float` typeDaniel Micay-1454/+2
It is simply defined as `f64` across every platform right now. A use case hasn't been presented for a `float` type defined as the highest precision floating point type implemented in hardware on the platform. Performance-wise, using the smallest precision correct for the use case greatly saves on cache space and allows for fitting more numbers into SSE/AVX registers. If there was a use case, this could be implemented as simply a type alias or a struct thanks to `#[cfg(...)]`. Closes #6592 The mailing list thread, for reference: https://mail.mozilla.org/pipermail/rust-dev/2013-July/004632.html
2013-09-30std: Remove usage of fmt!Alex Crichton-16/+16