summary refs log tree commit diff
path: root/src/libstd/num/f64.rs
AgeCommit message (Collapse)AuthorLines
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-16/+10
2014-03-05add correct floating point `min` and `max` methods.Daniel Micay-2/+10
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-68/+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/+27
2014-01-13Remove RealExtBrendan Zabarauskas-31/+1
These functions are of little utility outside a small subset of use cases. If people need them for their own projects then they can use their own bindings for libm (which aren't hard to make).
2014-01-09auto merge of #11412 : bjz/rust/num-cleanups, r=alexcrichtonbors-80/+70
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-80/+70
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-7/+7
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-76/+74
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
2013-10-01Add new lint: non_uppercase_pattern_statics, for #7526.Felix S. Klock II-0/+1
This tries to warn about code like: ```rust match (0,0) { (0, aha) => { ... }, ... } ``` where `aha` is actually a static constant, not a binding.
2013-09-25rustdoc: Change all code-blocks with a scriptAlex Crichton-2/+2
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g' find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g' find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-21auto merge of #9369 : sebcrozet/rust/f64_inline, r=thestingerbors-0/+1
This was, somehow, missed by #8332.
2013-09-21std: add missing #[inline] annotation to the f64 neg method.Sébastien Crozet-0/+1
This was, somehow, missed by #8332.
2013-09-19Rename the NaN and is_NaN methods to lowercase.Chris Morgan-42/+42
This is for consistency in naming conventions. - ``std::num::Float::NaN()`` is changed to ``nan()``; - ``std::num::Float.is_NaN()`` is changed to ``is_nan()``; and - ``std::num::strconv::NumStrConv::NaN()`` is changed to ``nan()``. Fixes #9319.
2013-09-19auto merge of #9291 : jzelinskie/rust/remove-cond, r=alexcrichtonbors-18/+18
This is my first contribution, so please point out anything that I may have missed. I consulted IRC and settled on `match () { ... }` for most of the replacements.
2013-09-18Remove and replace cond! Closes #9282.Jimmy Zelinskie-18/+18
2013-09-18std: Remove {float,f64,f32}::from_str in favor of from_strblake2-ppc-60/+52
Like issue #9209, remove float::{from_str, from_str_radix} in favor of the two corresponding traits. The same for modules f64 and f32. New usage is from_str::<float>("1.2e34")
2013-09-12std: Add a bunch of Default implsErick Tryzelaar-0/+6