Commit Graph

519 Commits

Author SHA1 Message Date
Yoan Lecoq 3896c64dc7 Attempt to work around E0425 in test macros on Rust 1.8 2017-04-30 10:33:35 +02:00
Yoan Lecoq 3f6ea76e60 Removed some #[inline] hints again 2017-04-30 10:17:44 +02:00
Yoan Lecoq 807584688c Added some tests for Wrapping<T>'s impls 2017-04-30 10:17:06 +02:00
Yoan Lecoq b90cfaaa7f Revert "impl PrimInt for Wrapping<T>"
This reverts commit 579466d95c.
2017-04-30 08:32:59 +02:00
Yoan Lecoq f4e0b47ceb Revert #[inline] hints 2017-04-30 08:32:25 +02:00
Yoan Lecoq 81aa6dbe48 Revert impl for Checked and Saturating 2017-04-30 08:29:21 +02:00
Yoan Lecoq 760604361d Add missing #[inline] hints 2017-04-29 08:35:37 +02:00
Yoan Lecoq 47b8c7b5ae impl Wrapping ops for Wrapping<T> 2017-04-29 08:29:02 +02:00
Yoan Lecoq 9c3e9791d2 impl Checked* and Saturating for Wrapping<T> 2017-04-29 08:22:44 +02:00
Yoan Lecoq f249edf546 impl ToPrimitive, FromPrimitive and NumCast for Wrapping<T> 2017-04-29 08:04:59 +02:00
Yoan Lecoq 35a9bcba19 impl Bounded for Wrapping<T> 2017-04-29 07:51:04 +02:00
Yoan Lecoq b2d957fe4b Small fix for older Rust versions 2017-04-29 07:47:39 +02:00
Yoan Lecoq 579466d95c impl PrimInt for Wrapping<T> 2017-04-29 07:46:51 +02:00
Yoan Lecoq 5b126673aa impl Signed and Unsigned for Wrapping<T> 2017-04-29 07:21:14 +02:00
Homu e2ea246016 Auto merge of #279 - yoanlcq:impl-num-for-wrapping, r=cuviper
Implemented Zero, One and Num for std::num::Wrapping<T>

Attempts to fix issue #278
2017-04-22 02:18:42 +09:00
Yoan Lecoq 2172a9368b impl One for Wrapping doesn't require Add 2017-04-21 19:10:42 +02:00
Yoan Lecoq 356a4ba5b5 Removed useless trait bounds 2017-04-21 18:56:23 +02:00
Yoan Lecoq b562c1ec39 Minor changes for correctness 2017-04-21 18:47:42 +02:00
Yoan Lecoq 9b06d4a0bb Attempt at fixing E0411 on older rust versions 2017-04-21 10:31:29 +02:00
Yoan Lecoq b024e1c326 Implemented Zero, One and Num for Wrapping<T> 2017-04-21 09:26:53 +02:00
Josh Stone 6513a5618b num-integer-0.1.34 2017-04-09 06:22:05 -07:00
Josh Stone fca95eaf42 num-complex-0.1.37 2017-04-09 06:18:09 -07:00
Homu aff06286ad Auto merge of #275 - bluss:repr-c, r=cuviper
Complex: Use repr(C) and add documentation for what it means

Here's an ambitious proposal that puts currently practiced ffi usage of `Complex<f32/f64>` on sound footing.

Fixes  #79

Current users appear to be:

- https://crates.io/crates/blas
  + Their use is not about Complex<f64> in an extern function's signature, but it is explicitly using that it is memory layout compatible.
2017-04-05 01:53:14 +09:00
bluss 0cf3419b9e complex: Use repr(C) and add documentation for what it means 2017-04-04 06:48:35 +02:00
Homu f63c933737 Auto merge of #272 - vks:binomial-coeffs, r=cuviper
Implement an iterator over the binomial coefficients

I'm not very happy with the excessive cloning, but to fix it the bounds on the type parameters would have to be excessive. We probably need something like [this](https://github.com/vks/discrete-log/blob/master/src/main.rs#L90) in `num-traits`.
2017-03-31 10:29:14 +09:00
Vinzent Steinberg 0fc6cb15a5 binomial: Discuss overflow 2017-03-29 14:13:39 +02:00
Vinzent Steinberg a7b459c05e Make `binomial` and `IterBinomial` less likely to overflow 2017-03-26 15:57:25 +02:00
Homu 4fc1e28832 Auto merge of #271 - vks:multinomial, r=cuviper
Implement multinomial
2017-03-26 04:40:20 +09:00
Homu 904d9b494f Auto merge of #170 - DonSheddow:complex-fmt, r=cuviper
Add formatting options for Complex

This adds LowerExp and UpperExp traits for Complex, taking precision into account. Fixes #148
2017-03-26 04:31:24 +09:00
Sigurd Kolltveit 2784b89837 Remove support for zero padding 2017-03-20 19:04:17 +01:00
Vinzent Steinberg d4deba6947 IterBinomial: Make tests closer to overflow threshold (like for binomial) 2017-03-20 10:45:27 +01:00
Vinzent Steinberg 47613ff5ff IterBinomial: Only return coefficient 2017-03-20 10:20:15 +01:00
Vinzent Steinberg e486e6a981 Address some of @cuviper's feedback 2017-03-20 10:14:01 +01:00
Vinzent Steinberg 3de345f912 Don't panic when calculating multinomial 2017-03-20 09:43:01 +01:00
Sigurd Kolltveit e044cfbc6d Simplify some lines 2017-03-18 17:24:00 +01:00
Sigurd Kolltveit 69943915ba Add more string formatting tests 2017-03-18 16:04:53 +01:00
Sigurd Kolltveit e2759e0321 Implement more formatting options for Complex 2017-03-18 16:04:53 +01:00
Sigurd Kolltveit 6113192e04 Add tests for more formatting options 2017-03-18 16:04:53 +01:00
Sigurd Kolltveit f138f3da9e Add formatting options for Complex 2017-03-18 16:04:53 +01:00
Vinzent Steinberg c408bd6605 Try to fix build on Rust 1.8 2017-03-17 18:21:06 +01:00
Vinzent Steinberg 8d235759dd Implement an iterator over the binomial coefficients 2017-03-17 18:03:58 +01:00
Vinzent Steinberg ebe3f85976 Implement multinomial 2017-03-17 17:27:46 +01:00
Homu 2adf018aa6 Auto merge of #270 - vks:binomial, r=cuviper
Implement binomial

The implementation avoids overflows and fractions.
2017-03-16 08:55:20 +09:00
Vinzent Steinberg 40cbe1ff20 Use correct formula 2017-03-12 10:23:27 +01:00
Vinzent Steinberg 07df43b034 Address binomial review feedback
* Use substraction instead of division in comparison.
* More tests.
* Add comment.
2017-03-12 10:17:49 +01:00
Vinzent Steinberg 2f6eb31903 Implement binomial
The implementation avoids overflows and fractions.
2017-03-11 16:44:51 +01:00
Josh Stone d23e3f32b8 num-bigint-0.1.37 2017-03-08 11:14:32 -08:00
Homu fe21c725e8 Auto merge of #269 - cuviper:biguint-parse-plus, r=cuviper
bigint: Create the parsing error better for nested `+`

If a `+` is encountered in the middle of parsing a BigUint, this should
generate an `ParseIntError::InvalidDigit`.  Since we can't create that
directly, we get it by trying to parse a `u64` from this point, but of
course `+` is a perfectly valid prefix to a `u64`.

Now we include the previous character in the string passed to `u64`, so it
has proper parsing context to understand what's in error.

Fixes #268.
2017-03-09 04:10:48 +09:00
Josh Stone 0b6cae0dc7 bigint: Create the parsing error better for nested `+`
If a `+` is encountered in the middle of parsing a BigUint, this should
generate an `ParseIntError::InvalidDigit`.  Since we can't create that
directly, we get it by trying to parse a `u64` from this point, but of
course `+` is a perfectly valid prefix to a `u64`.

Now we include the previous character in the string passed to `u64`, so
it has proper parsing context to understand what's in error.

Fixes #268.
2017-03-06 13:23:40 -08:00
Josh Stone 4b8c71fbec bigint: Cleanup unused imports 2017-03-06 13:20:30 -08:00