Commit Graph

374 Commits

Author SHA1 Message Date
Josh Stone 18b3cb425d complex: bump to 0.1.33 2016-07-12 01:10:37 -07:00
Josh Stone 9924163086 bigint: bump to 0.1.33 2016-07-12 01:10:37 -07:00
Josh Stone f056603bc0 traits: bump to 0.1.33 2016-07-12 01:10:37 -07:00
Josh Stone 8f5a27284c Remove an unused ToBigUint import 2016-07-12 00:40:10 -07:00
Josh Stone b21c89de36 Mask deprecation warnings on abs_sub 2016-07-12 00:34:55 -07:00
Josh Stone 15949b257a Move .multirust.sh to .rustup.sh
(rustup is pickier about paths to non-rust commands though...)
2016-07-12 00:34:27 -07:00
Homu 7fcd5f7304 Auto merge of #205 - cuviper:bigint-sub, r=hauleth
bigint: allow `Sub` to work in-place on the RHS

A new Fibonacci benchmark demonstrates the improvement by using both
addition and subtraction in each iteration of the loop, like #200.

Before:

    test fib2_100          ... bench:       4,558 ns/iter (+/- 3,357)
    test fib2_1000         ... bench:      62,575 ns/iter (+/- 5,200)
    test fib2_10000        ... bench:   2,898,425 ns/iter (+/- 207,973)

After:

    test fib2_100          ... bench:       1,973 ns/iter (+/- 102)
    test fib2_1000         ... bench:      41,203 ns/iter (+/- 947)
    test fib2_10000        ... bench:   2,544,272 ns/iter (+/- 45,183)
2016-07-11 01:21:49 +09:00
Josh Stone 388a3132b8 bigint: allow `Sub` to work in-place on the RHS
A new Fibonacci benchmark demonstrates the improvement by using both
addition and subtraction in each iteration of the loop, like #200.

Before:

    test fib2_100          ... bench:       4,558 ns/iter (+/- 3,357)
    test fib2_1000         ... bench:      62,575 ns/iter (+/- 5,200)
    test fib2_10000        ... bench:   2,898,425 ns/iter (+/- 207,973)

After:

    test fib2_100          ... bench:       1,973 ns/iter (+/- 102)
    test fib2_1000         ... bench:      41,203 ns/iter (+/- 947)
    test fib2_10000        ... bench:   2,544,272 ns/iter (+/- 45,183)
2016-07-08 17:34:12 -07:00
Josh Stone a7ac5e4299 Merge pull request #199 from adamcrume/master, r=hauleth
Implement Default for Complex
2016-07-01 10:19:08 -07:00
Josh Stone 1e663952fc Merge pull request #201 from cuviper/faster-add2-sub2, r=hauleth
bigint: simplify the add2/sub2 loops
2016-07-01 10:18:32 -07:00
Adam Crume c7c974ec4b Implement Default for Complex
Fixes #198
2016-06-29 18:33:19 -07:00
Josh Stone 609629d34d bigint: simplify the add2/sub2 loops
This splits the main arithmetic loops from the final carry/borrow
propagation, and also normalizes the slice lengths before iteration.
This lets the optimizer generate better code for these functions.
2016-06-29 18:19:47 -07:00
Homu f0bc5596af Auto merge of #196 - SuperFluffy:remove_use_serde, r=hauleth
`use serde;` leads to compilation error; `extern crate` is enough

This PR fixes the compile error of `num-complex` that appears due to a redundant `use serde;` after `extern crate serde;` in the same module. To reproduce the error, just build `num-complex` with the feature `serde`, see below.

```zsh
% cargo build --features serde
   Compiling num-complex v0.1.32 (file:///home/janis/github/num/complex)
src/lib.rs:27:5: 27:10 error: an extern crate named `serde` has already been imported in this module [E0259]
src/lib.rs:27 use serde;
                  ^~~~~
src/lib.rs:19:1: 19:20 note: previous import of `serde` here
src/lib.rs:19 extern crate serde;
              ^~~~~~~~~~~~~~~~~~~
src/lib.rs:27:5: 27:10 help: run `rustc --explain E0259` to see a detailed explanation
error: aborting due to previous error
error: Could not compile `num-complex`.
```
2016-06-13 23:14:11 +09:00
Richard Janis Goldschmidt c8543380ea Remove `use`ing serde. Import through `extern crate` is enough 2016-06-13 15:46:56 +02:00
Josh Stone 72a146b9ed macros: bump to 0.1.33 2016-05-18 16:28:32 -07:00
Josh Stone 0adac57e11 macros: init MethodDef.unify_fieldless_variants to false
AFAICT this field is irrelevant to us, but it still must be initialized.
2016-05-18 16:24:33 -07:00
Homu ace0951f2a Auto merge of #192 - vks:split-func, r=cuviper
Move functions remaining in num to num-traits

Fixes #102.
2016-05-14 02:36:58 +09:00
Vinzent Steinberg 3e4595eac6 Move functions remaining in num to num-traits
Fixes #102.
2016-05-13 10:38:14 +02:00
Homu 4bbc34b083 Auto merge of #190 - rust-num:private-crates, r=cuviper
num: remove `pub` from sub-crates

Rust 1.4 through 1.7 will issue warnings that `pub extern crate` does
not work as expected, although it appears to be fine.  But Rust 1.8 and
later issue `#[warn(private_in_public)]` for `pub use num_foo as foo` if
that crate isn't public, and that's headed toward a hard error.

@bluss suggested instead `pub mod foo { pub use num_foo::*; }`, which
I thought I had tried before, but it appears to work fine on all
versions of Rust.  Let's do it!

A small downside is that docs for `num::foo` now just show the wildcard
reexport, instead of direct documentation, but at least there's a link
to follow to the sub-crate.

It's a breaking change that `num::num_foo` paths are no longer public,
but we didn't really want those exposed in the first place.  I consider
this minor -- people should either use the `num::foo` module as before
the split-up, or use the `num_foo` crate directly.

Fixes #189.
2016-05-13 04:55:55 +09:00
Josh Stone 865c491ce2 num: remove `pub` from sub-crates
Rust 1.4 through 1.7 will issue warnings that `pub extern crate` does
not work as expected, although it appears to be fine.  But Rust 1.8 and
later issue `#[warn(private_in_public)]` for `pub use num_foo as foo` if
that crate isn't public, and that's headed toward a hard error.

@bluss suggested instead `pub mod foo { pub use num_foo::*; }`, which
I thought I had tried before, but it appears to work fine on all
versions of Rust.  Let's do it!

A small downside is that docs for `num::foo` now just show the wildcard
reexport, instead of direct documentation, but at least there's a link
to follow to the sub-crate.

It's a breaking change that `num::num_foo` paths are no longer public,
but we didn't really want those exposed in the first place.  I consider
this minor -- people should either use the `num::foo` module as before
the split-up, or use the `num_foo` crate directly.

Fixes #189.
2016-04-29 15:36:17 -07:00
Homu ffaee11f91 Auto merge of #188 - koverstreet:master, r=cuviper
bigint: Fix calculation of size for multiply temporaries

When x.len() and y.len() are both equal and odd, we have x1.len() + y1.len() + 1
(the required size to multiply x1 and y1) > y.len() + 1

This fixes #187
2016-04-21 08:57:08 +09:00
Kent Overstreet 1e65e9dc51 bigint: Fix calculation of size for multiply temporaries
When x.len() and y.len() are both equal and odd, we have x1.len() + y1.len() + 1
(the required size to multiply x1 and y1) > y.len() + 1

This fixes #187
2016-04-20 15:48:02 -08:00
Homu 39c1de8841 Auto merge of #137 - liebharc:master, r=cuviper
Added powc, powf, log and expf methods for complex numbers

I would like to have a few functions added for complex numbers (powf, log and exp function with arbitrary base). I've provided an implementation with this commit. However it requires more work and discussion and I've added comments to point out the parts which I'm especially unhappy with. Would be nice to get some feedback so that we can improve this pull request first.
2016-04-18 07:06:39 +09:00
Christian Liebhardt 24fcc1575a Added powc, powf, log and expf methods for complex numbers 2016-04-15 11:28:43 -07:00
Homu 0861fb4cfb Auto merge of #180 - bluss:fix-toprimitive-float, r=cuviper
Fix ToPrimitive for f64 -> f32 conversion.

Fix ToPrimitive for f64 -> f32 conversion.

It should use the destination type and not the source type to check if
the conversion would be to a value that's in range.

NOTE: A finite f64 value that is larger than the f32 value range now produces
None when converted to f32 with ToPrimitive.

Previously, too large f64 values would produce inf f32 values. This `as`
cast has an undefined result and was not specified to always produce for
example `inf`.

The conversion preserves nan/+-inf specifically.
2016-04-16 01:32:23 +09:00
bluss acde249bf7 traits: Fix ToPrimitive for f64 -> f32 conversion.
It should use the destination type and not the source type to check if
the conversion would be to a value that's in range.

NOTE: A finite f64 value that is larger than the f32 value range now produces
None when converted to f32 with ToPrimitive.

Previously, too large f64 values would produce inf f32 values. This `as`
cast has an undefined result and was not specified to always produce for
example `inf`.

The conversion preserves nan/+-inf specifically.
2016-04-15 13:36:29 +02:00
Josh Stone 1e192c31ae num: add path-dependency versions 2016-04-14 00:45:03 -07:00
Josh Stone 0dd410468c rational: add path-dependency versions 2016-04-14 00:39:07 -07:00
Josh Stone 164da50a99 iter: add path-dependency versions 2016-04-14 00:37:04 -07:00
Josh Stone dc733b1402 complex: add path-dependency versions 2016-04-14 00:29:19 -07:00
Josh Stone 0b79edc108 bigint: add path-dependency versions 2016-04-14 00:26:54 -07:00
Josh Stone 84ffb0ad01 integer: add path-dependency versions 2016-04-14 00:25:51 -07:00
Josh Stone 2e8ce33d84 Bump all num crates to 0.1.32 2016-04-14 00:17:42 -07:00
Homu 774bf31ec6 Auto merge of #182 - ollie27:ratio_posneg, r=cuviper
Correct Ratio::is_negative and Ratio::is_positive

Zero is not positive or negative.

This was broken in 8be7e7bab5.
2016-04-14 07:05:42 +09:00
Oliver Middleton c22e3bf9a2 Correct Ratio::is_negative and Ratio::is_positive
Zero is not positive or negative.

This was broken in 8be7e7bab5.
2016-04-13 22:47:15 +01:00
Homu 095738e7de Auto merge of #164 - rust-num:split-into-crates, r=cuviper
Move segments of library to separate crates

Issue #102

- [x] traits
- [x] bigint
- [x] integer
- [x] complex
- [x] iter
- [x] rational
2016-04-14 05:30:34 +09:00
Łukasz Jan Niemier 58b5fe5883 Serializers dependencies 2016-04-11 20:43:07 +02:00
Łukasz Jan Niemier e59ead7b3a Add Serde crate to `num_bigint` 2016-04-11 12:32:10 +02:00
Łukasz Jan Niemier 8450782413 Revert old `num` crate description 2016-04-11 12:30:16 +02:00
Łukasz Jan Niemier 3d11940538 Better descriptions for subcrates 2016-04-10 10:31:22 +02:00
Josh Stone a423b39833 .multirust.sh: use the subcrated "make test" 2016-03-25 18:30:27 -07:00
Josh Stone 015cd0be43 .travis.yml: add a verbose build
I like to have a verbose build log for automation like Travis CI,
because it sometimes helps in diagnosing failures.
2016-03-25 18:30:27 -07:00
Josh Stone c9d82acf00 test_features.sh: re-enable as a simple build 2016-03-25 18:30:27 -07:00
Josh Stone 03884fdbcc bigint: reapply #176 2016-03-25 17:50:51 -07:00
Josh Stone aebbc4fd37 bigint: fix and un-ignore the first doctest 2016-03-25 17:50:51 -07:00
Josh Stone 8845ee11ed integer: reapply the rest of #167 2016-03-25 17:50:51 -07:00
Josh Stone 0114559adf Makefile: add complex and iter 2016-03-25 17:50:51 -07:00
Josh Stone 8cb026e273 complex: update testing imports and hash 2016-03-25 17:50:51 -07:00
Josh Stone e672d006a4 iter: update testing imports 2016-03-25 17:50:51 -07:00
Josh Stone dac48aa4da test_nightly.sh: update the macros path 2016-03-25 17:50:51 -07:00