about summary refs log tree commit diff
path: root/src/libstd/num/f32.rs
AgeCommit message (Collapse)AuthorLines
2014-04-22auto merge of #13597 : bjz/rust/float-api, r=brsonbors-146/+212
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-20auto merge of #13410 : alexcrichton/rust/issue-12278, r=pcwaltonbors-1/+4
This commit removes the compiler support for floating point modulus operations, as well as from the language. An implementation for this operator is now required to be provided by libraries. Floating point modulus is rarely used, doesn't exist in C, and is always lowered to an fmod library call by LLVM, and LLVM is considering removing support entirely. Closes #12278
2014-04-19Reorder Float methods in trait definition and make consistent in implsBrendan Zabarauskas-100/+105
2014-04-19Fix formatting in float implementationsBrendan Zabarauskas-36/+99
2014-04-19Have floating point functions take their parameters by value.Brendan Zabarauskas-54/+54
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-27/+25
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-15std: Un-ignore some float tests on windowsAlex Crichton-1/+1
These were fixed in the upgrade from mingw32 to mingw64. Closes #8663
2014-04-08rustc: Remove f{32,64} % from the languageAlex Crichton-1/+4
This commit removes the compiler support for floating point modulus operations, as well as from the language. An implementation for this operator is now required to be provided by libraries. Floating point modulus is rarely used, doesn't exist in C, and is always lowered to an fmod library call by LLVM, and LLVM is considering removing support entirely. Closes #12278
2014-04-04Removed cmath and instrinsic wrapper.Michael Darakananda-102/+39
2014-04-01remove the cmath moduleDaniel Micay-26/+58
This is an implementation detail of the `f32` and `f64` modules and it should not be public. It renames many functions and leaves out any provided by LLVM intrinsics, so it is not a sensible binding to the C standard library's math library and will never be a stable target. This also removes the abuse of link_name so that this can be switched to using automatically generated definitions in the future. This also removes the `scalbn` binding as it is equivalent to `ldexp` when `FLT_RADIX` is 2, which must always be true for Rust.
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-1/+1
Closes #2569
2014-03-25libstd: Document the following modules:Patrick Walton-1/+1
* native::io * std::char * std::fmt * std::fmt::parse * std::io * std::io::extensions * std::io::net::ip * std::io::net::udp * std::io::net::unix * std::io::pipe * std::num * std::num::f32 * std::num::f64 * std::num::strconv * std::os
2014-03-05add tests for `min` and `max` from `Float`Daniel Micay-0/+12
2014-03-05consistently use LLVM floating point intrinsicsDaniel Micay-14/+8
2014-03-05add correct floating point `min` and `max` methods.Daniel Micay-0/+11
The `std::cmp` functions are not correct for floating point types. `min(NaN, 2.0)` and `min(2.0, NaN)` return different values, because these functions assume a total order. Floating point types need special `min`, `max` and `clamp` functions.
2014-02-24Remove std::from_str::FromStr from the preludeBrendan Zabarauskas-0/+1
2014-02-24auto merge of #12445 : huonw/rust/less-unsafe, r=alexcrichtonbors-4/+2
Commits for details. Highlights: - `flate` returns `CVec<u8>` to save reallocating a whole new `&[u8]` - a lot of `transmute`s removed outright or replaced with `as` (etc.)
2014-02-23Remove all ToStr impls, add Show implsAlex Crichton-6/+0
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-24arena,std,serialize: remove some unnecessary transmutes.Huon Wilson-4/+2
`as`-able transmutes, duplication and manual slice decomposition are silly.
2014-02-23std: Move intrinsics to std::intrinsics.Brian Anderson-1/+1
Issue #1457
2014-02-20move extra::test to libtestLiigo Zhuang-1/+0
2014-02-17Remove Real trait and move methods into FloatBrendan Zabarauskas-164/+162
This is part of the effort to simplify `std::num`, as tracked in issue #10387.
2014-02-15Silence some unused import warningsAlex Crichton-1/+0
2014-02-13Removed num::OrderableMichael Darakananda-60/+0
2014-01-31Fix minor doc typosVirgile Andreani-4/+4
2014-01-30Remove unused imports.OGINO Masanori-1/+0
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-22Remove the initial and trailing blank doc-comment linesSiegeLord-40/+0
2014-01-22Add LowerExp 'e' and UpperExp 'E' format traits/specifiersSiegeLord-0/+34
2014-01-22float_to_str_bytes_common can now handle exponential notationSiegeLord-6/+6
2014-01-18auto merge of #11622 : bjz/rust/simplify-primitive-trait, r=brsonbors-17/+8
As part of #10387, this removes the `Primitive::{bits, bytes, is_signed}` methods and removes the trait's operator trait constraints for the reasons outlined below: - The `Primitive::{bits, bytes}` associated functions were originally added to reflect the existing `BITS` and `BYTES`statics included in the numeric modules. These statics are only exist as a workaround for Rust's lack of CTFE, and should be deprecated in the future in favor of using the `std::mem::size_of` function (see #11621). - `Primitive::is_signed` seems to be of little utility and does not seem to be used anywhere in the Rust compiler or libraries. It is also rather ugly to call due to the `Option<Self>` workaround for #8888. - The operator trait constraints are already covered by the `Num` trait.
2014-01-18Add FIXME comments regarding issue #11526.Brendan Zabarauskas-0/+7
2014-01-18Simplify std::num::Primitive trait definitionBrendan Zabarauskas-17/+1
This removes the `Primitive::{bits, bytes, is_signed}` methods and removes the operator trait constraints, for the reasons outlined below: - The `Primitive::{bits, bytes}` associated functions were originally added to reflect the existing `BITS` and `BYTES` statics included in the numeric modules. These statics are only exist as a workaround for Rust's lack of CTFE, and should probably be deprecated in the future in favor of using the `std::mem::size_of` function (see #11621). - `Primitive::is_signed` seems to be of little utility and does not seem to be used anywhere in the Rust compiler or libraries. It is also rather ugly to call due to the `Option<Self>` workaround for #8888. - The operator trait constraints are already covered by the `Num` trait.
2014-01-17Add a generic power functionFlavio Percoco-2/+2
The patch adds a `pow` function for types implementing `One`, `Mul` and `Clone` trait. The patch also renames f32 and f64 pow into powf in order to still have a way to easily have float powers. It uses llvms intrinsics. The pow implementation for all num types uses the exponentiation by square. Fixes bug #11499
2014-01-16Merge Bitwise and BitCount traits and remove from prelude, along with BoundedBrendan Zabarauskas-1/+1
One less trait in std::num, and three less exported in the prelude.
2014-01-13Clean up std::num::cmath and remove stale commentsBrendan Zabarauskas-39/+43
2014-01-09auto merge of #11412 : bjz/rust/num-cleanups, r=alexcrichtonbors-79/+69
The methods contained in `std::num::{Algebraic, Trigonometric, Exponential, Hyperbolic}` have now been moved into `std::num::Real`. This is part of an ongoing effort to simplify `std::num` (see issue #10387). `std::num::RealExt` has also been removed from the prelude because it is not a commonly used trait. r? @alexcrichton
2014-01-09Remove ApproxEq and assert_approx_eq!Brendan Zabarauskas-25/+0
This trait seems to stray too far from the mandate of a standard library as implementations may vary between use cases.
2014-01-09Merge some numeric traits with Real and don't re-export RealExtBrendan Zabarauskas-79/+69
The methods contained in `std::num::{Algebraic, Trigonometric, Exponential, Hyperbolic}` have now been moved into `std::num::Real`. This is part of an ongoing effort to simplify `std::num` (see issue #10387). `std::num::RealExt` has also been removed from the prelude because it is not a commonly used trait.
2013-12-27std: uniform modules titles for docLuca Bruno-1/+1
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-1/+2
2013-12-08Remove dead codesKiet Tran-10/+10
2013-12-04Decode a float into integersVolker Mische-0/+29
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-11-29Removed a few macro-expanding-to-module workaroundsMarvin Löbel-20/+13
Also documented a few issues
2013-11-11Remove #[fixed_stack_segment] and #[rust_stack]Alex Crichton-1/+1
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-10-28Capitalize statics in f32 and f64 modsZiad Hatahet-67/+65
Fixes #10077
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-1/+1
Who doesn't like a massive renaming?
2013-10-17std: Move size/align functions to std::mem. #2240Brian Anderson-3/+3
2013-10-05std: add Primitive.is_signedErick Tryzelaar-0/+3
2013-10-02auto merge of #9638 : ↵bors-0/+1
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-09-30std: Remove usage of fmt!Alex Crichton-2/+2