Łukasz Jan Niemier
c124be549f
Move traits to separate crate
2016-03-11 01:06:05 +01:00
Murarth
df34563eda
Expose `BigUint::bits` through `BigInt`
2016-03-05 13:46:22 -07:00
Erick Tryzelaar
112923eec5
Add support for Serde 0.7.
...
Serde 0.7 dropped it's dependency on num, so this patch moves
the implementations here. For the sake of a better implementation,
this just serializes BigUint as a `Vec<u32>`, `BigInt` as a
`(u8, Vec<u32>)`, `Complex<T>` as a `(T, T)`, and `Ratio<T>`
as a `(T, T)`.
2016-02-27 00:07:32 -08:00
Josh Stone
4e66bbe6a7
Avoid overflows in Ratio's Ord::cmp
...
Fixes #7
2016-02-22 18:10:29 -08:00
Josh Stone
8be7e7bab5
Simplify some Ratio methods
2016-02-22 18:09:21 -08:00
Josh Stone
5b2cb8df97
Simplify Integer dependant traits
...
- Integer only needs to require Ord explicitly, and then PartialOrd, Eq,
and PartialEq come transitively.
- Generics on Integer can implicitly use all of those comparison traits.
This should not be a breaking change, as it doesn't actually change any
effective trait requirements -- only what's explicit for simplicity.
2016-02-22 15:34:10 -08:00
Mike MacDonald (crazymykl)
9def836603
Allow unary `+` when parsing BigInt from strings
2016-02-21 18:09:56 -05:00
Felix S. Klock II
d298262573
Reorder ops in LCM to avoid overflow. Fix #166
2016-02-18 22:49:34 +01:00
Josh Stone
ebed6756de
impl Debug for ParseFloatError
...
Fixes #165 .
2016-02-16 15:37:06 -08:00
Josh Stone
9b2116d78f
Fix spelling of "occurred".
2016-02-05 16:04:34 -08:00
est31
3c5ecdc636
Add checked_pow function
2016-02-03 06:43:40 +01:00
Josh Stone
afee4e4662
Change PrimInt shift names to signed/unsigned
2016-01-28 22:37:18 -08:00
Josh Stone
d798bd4fb8
Add arithmetic/logical shifts to PrimInt
2016-01-27 23:30:33 -08:00
Josh Stone
b454a14bc4
bigint: avoid new allocations for small shifts
...
Before:
test shl ... bench: 7,312 ns/iter (+/- 218)
test shr ... bench: 5,282 ns/iter (+/- 243)
After:
test shl ... bench: 4,946 ns/iter (+/- 88)
test shr ... bench: 4,121 ns/iter (+/- 52)
2016-01-27 23:08:47 -08:00
Oliver Middleton
95d8ccdb24
bigint: Make fmt traits take into account formatting parameters
2016-01-22 00:35:35 +00:00
Colin Davidson
3c7441ab0a
Add Binary, Octal to BigUint. Add UpperHex, LowerHex, Binary, Octal to BigInt
2016-01-18 21:19:21 -08:00
Colin Davidson
a89a2e82e6
Fix test names
...
Upper and Lower test names were swapped
2016-01-17 12:17:52 -08:00
Colin Davidson
d5d7c855b0
Add tests for UpperHex and LowerHex
2016-01-17 12:13:45 -08:00
Colin Davidson
04000436b1
Switch to ascii uppercase function
2016-01-16 22:27:56 -08:00
Colin Davidson
80c4d01b7f
Add LowerHex and UpperHex formatting
2016-01-16 21:52:47 -08:00
Alex Burka
5962dd29c9
remove stale #[deriving(Zero)] docs
...
Fixes #156 .
2016-01-15 13:29:34 -05:00
Homu
e65fd4e5b2
Auto merge of #150 - ollie27:bigint_to_str, r=cuviper
...
bigint: small to_str_radix optimization
Before:
```
test fac_to_string ... bench: 1,630 ns/iter (+/- 34)
test fib_to_string ... bench: 359 ns/iter (+/- 11)
test to_str_radix_02 ... bench: 3,097 ns/iter (+/- 19)
test to_str_radix_08 ... bench: 1,146 ns/iter (+/- 38)
test to_str_radix_10 ... bench: 4,248 ns/iter (+/- 36)
test to_str_radix_16 ... bench: 881 ns/iter (+/- 44)
test to_str_radix_36 ... bench: 8,073 ns/iter (+/- 75)
```
After:
```
test fac_to_string ... bench: 1,492 ns/iter (+/- 20)
test fib_to_string ... bench: 368 ns/iter (+/- 7)
test to_str_radix_02 ... bench: 2,038 ns/iter (+/- 47)
test to_str_radix_08 ... bench: 812 ns/iter (+/- 9)
test to_str_radix_10 ... bench: 3,919 ns/iter (+/- 40)
test to_str_radix_16 ... bench: 703 ns/iter (+/- 58)
test to_str_radix_36 ... bench: 7,852 ns/iter (+/- 81)
```
2016-01-13 08:59:01 +09:00
Brian Smith
9e3e8552ac
Make `rand` and `rustc-serialize` dependencies optional.
...
Previously, the `rand` and `rustc-serialize` dependencies were optional
except they were required for the `bigint` feature.
Make the dependency on the `rand` crate optional in all cases.
including when the `bigint` feature is selected. Some of the tests for
the bigint feature are randomized so, while `rand` is now an optional
dependency, it is a non-optional dev-dependency.
Similarly, make the dependency on the `rustc-serialize` crate optional
in all cases, including when the `bigint` feature is selected.
2016-01-07 16:30:50 -10:00
Josh Stone
22722ac55d
pow: shift exp powers of 2 before accumulating
...
We can save a multiplication if we start the accumulation basically at
the first set bit of the exponent, rather than starting at one and
waiting to multiply. We only need one itself if the exponent is zero,
which is easy to pre-check.
Before:
test pow_bench ... bench: 8,267,370 ns/iter (+/- 93,319)
After:
test pow_bench ... bench: 7,506,463 ns/iter (+/- 116,311)
2016-01-06 18:32:01 -08:00
Oliver Middleton
d2b23d0f29
bigint: small to_str_radix optimization
...
Before:
test fac_to_string ... bench: 1,630 ns/iter (+/- 34)
test fib_to_string ... bench: 359 ns/iter (+/- 11)
test to_str_radix_02 ... bench: 3,097 ns/iter (+/- 19)
test to_str_radix_08 ... bench: 1,146 ns/iter (+/- 38)
test to_str_radix_10 ... bench: 4,248 ns/iter (+/- 36)
test to_str_radix_16 ... bench: 881 ns/iter (+/- 44)
test to_str_radix_36 ... bench: 8,073 ns/iter (+/- 75)
After:
test fac_to_string ... bench: 1,492 ns/iter (+/- 20)
test fib_to_string ... bench: 368 ns/iter (+/- 7)
test to_str_radix_02 ... bench: 2,038 ns/iter (+/- 47)
test to_str_radix_08 ... bench: 812 ns/iter (+/- 9)
test to_str_radix_10 ... bench: 3,919 ns/iter (+/- 40)
test to_str_radix_16 ... bench: 703 ns/iter (+/- 58)
test to_str_radix_36 ... bench: 7,852 ns/iter (+/- 81)
2016-01-05 18:01:12 +00:00
Łukasz Jan Niemier
8e267ee4cb
Fix docs and function position
2015-12-30 10:57:54 +01:00
Łukasz Jan Niemier
458e9594d4
Add complex `i` constant function
2015-12-29 16:36:08 +01:00
Oliver Middleton
2c235d2dde
bigint: cleanup float conversions
2015-12-24 18:15:56 +00:00
Oliver Middleton
a480c7ca6c
bigint: fix float conversions
...
The default implementations of to_f32, to_f64, from_32 and from_f64 are
limited to numbers fitting in i64 but BigInt can of course be much bigger.
The default to_f32 also has double rounding.
from_f32 and from_f64 have undefined behaviour if the float is too big to
fit in an i64.
This fixes these issues and keeps the rounding consistant with other float
to int conversions.
Also add ToBigUint and ToBigInt implementations for f32 and f64.
2015-12-23 07:30:40 +00:00
Josh Stone
2e3e575117
Fix the feature masks in the approx_sqrt doc example
...
The hidden "mod test" layout of the first example has been broken for a
while, but it wasn't noticed because rustdoc wasn't passing any features
at all. That was fixed in rust-lang/rust#30372 , and now we need to get
our ducks in a row too.
2015-12-21 12:21:47 -08:00
Homu
9b45e6dd9b
Auto merge of #139 - ollie27:bigint_hash, r=cuviper
...
bigint: simplify Hash
There cannot be any leading zeros in a BigUint so just derive Hash which will just hash the Vec directly.
Add Hash to Sign so we can derive it for BigInt as well.
2015-12-17 15:25:49 +09:00
Josh Stone
7593c17fa7
More bigint str_radix performance tweaks
2015-12-16 21:49:18 -08:00
Oliver Middleton
e152bbcb46
bigint: simplify Hash
...
There cannot be any leading zeros in a BigUint so just derive Hash which will just hash the Vec directly.
Add Hash to Sign so we can derive it for BigInt as well.
2015-12-16 19:08:24 +00:00
Josh Stone
c9e15aef2d
bigint: use full cmp results for checked_sub
2015-12-15 22:31:46 -08:00
Josh Stone
4a8752274c
bigint: slightly improve multiply/divide performance
...
Using `vec![0; len]` initialization is a little faster.
Before:
test multiply_0 ... bench: 354 ns/iter (+/- 6)
test multiply_1 ... bench: 33,966 ns/iter (+/- 1,508)
test multiply_2 ... bench: 3,663,686 ns/iter (+/- 60,880)
test divide_0 ... bench: 891 ns/iter (+/- 51)
test divide_1 ... bench: 17,316 ns/iter (+/- 387)
test divide_2 ... bench: 1,290,378 ns/iter (+/- 73,016)
After:
test multiply_0 ... bench: 351 ns/iter (+/- 39)
test multiply_1 ... bench: 30,827 ns/iter (+/- 680)
test multiply_2 ... bench: 3,692,968 ns/iter (+/- 91,146)
test divide_0 ... bench: 902 ns/iter (+/- 14)
test divide_1 ... bench: 16,981 ns/iter (+/- 102)
test divide_2 ... bench: 1,146,367 ns/iter (+/- 60,152)
2015-12-15 22:07:34 -08:00
Josh Stone
b7724a6650
Simplify BigInt Mul forwarding
2015-12-15 22:06:59 -08:00
Josh Stone
22ff3f918d
bigint: improve from_str_radix performance
...
Before:
test from_str_radix_02 ... bench: 8,432 ns/iter (+/- 280)
test from_str_radix_08 ... bench: 7,397 ns/iter (+/- 95)
test from_str_radix_10 ... bench: 7,344 ns/iter (+/- 142)
test from_str_radix_16 ... bench: 6,753 ns/iter (+/- 157)
test from_str_radix_36 ... bench: 7,093 ns/iter (+/- 60)
After:
test from_str_radix_02 ... bench: 3,295 ns/iter (+/- 81)
test from_str_radix_08 ... bench: 1,377 ns/iter (+/- 56)
test from_str_radix_10 ... bench: 1,583 ns/iter (+/- 16)
test from_str_radix_16 ... bench: 1,483 ns/iter (+/- 53)
test from_str_radix_36 ... bench: 1,628 ns/iter (+/- 27)
2015-12-15 21:59:51 -08:00
Josh Stone
49529895a2
bigint: greatly improve to_str_radix performance
...
Before:
test fac_to_string ... bench: 18,183 ns/iter (+/- 310)
test fib_to_string ... bench: 819 ns/iter (+/- 8)
test to_str_radix_02 ... bench: 204,479 ns/iter (+/- 2,826)
test to_str_radix_08 ... bench: 68,275 ns/iter (+/- 769)
test to_str_radix_10 ... bench: 61,809 ns/iter (+/- 907)
test to_str_radix_16 ... bench: 51,438 ns/iter (+/- 539)
test to_str_radix_36 ... bench: 39,939 ns/iter (+/- 976)
After:
test fac_to_string ... bench: 1,204 ns/iter (+/- 16)
test fib_to_string ... bench: 269 ns/iter (+/- 3)
test to_str_radix_02 ... bench: 2,428 ns/iter (+/- 80)
test to_str_radix_08 ... bench: 820 ns/iter (+/- 38)
test to_str_radix_10 ... bench: 2,984 ns/iter (+/- 303)
test to_str_radix_16 ... bench: 689 ns/iter (+/- 25)
test to_str_radix_36 ... bench: 7,995 ns/iter (+/- 100)
2015-12-15 21:57:27 -08:00
Oliver Middleton
9c7c995631
bigint: add tests for From implementations
2015-12-12 23:17:37 +00:00
Oliver Middleton
8e1c6a3c11
bigint: add From implementations
...
From all primative unsigned ints to BigUint
From all primative ints to BigInt
From BigUint to BigInt
Closes : #117
2015-12-12 23:16:03 +00:00
Kent Overstreet
fa372e230b
Multiply/divide torture test
2015-12-10 15:28:01 -09:00
Kent Overstreet
79928b3185
Improve division performance
...
Before:
test divide_0 ... bench: 4,058 ns/iter (+/- 255)
test divide_1 ... bench: 304,507 ns/iter (+/- 28,063)
test divide_2 ... bench: 668,293,969 ns/iter (+/- 25,383,239)
After:
test divide_0 ... bench: 874 ns/iter (+/- 71)
test divide_1 ... bench: 16,641 ns/iter (+/- 1,205)
test divide_2 ... bench: 1,336,888 ns/iter (+/- 77,450)
2015-12-10 15:25:56 -09:00
Kent Overstreet
08b0022aab
Improve multiply performance
...
The main idea here is to do as much as possible with slices, instead of
allocating new BigUints (= heap allocations).
Current performance:
multiply_0: 10,507 ns/iter (+/- 987)
multiply_1: 2,788,734 ns/iter (+/- 100,079)
multiply_2: 69,923,515 ns/iter (+/- 4,550,902)
After this patch, we get:
multiply_0: 364 ns/iter (+/- 62)
multiply_1: 34,085 ns/iter (+/- 1,179)
multiply_2: 3,753,883 ns/iter (+/- 46,876)
2015-12-10 15:25:42 -09:00
Kent Overstreet
496ae0337c
Add add/subtract functions that work in place, on slices
...
This is needed for the multiply optimizations in the next patch.
2015-12-10 12:33:28 -09:00
Josh Stone
7fa80f7786
Update intros to better reflect the breadth of num
...
Closes #132 .
2015-11-21 16:39:00 -08:00
Josh Stone
e41016975f
bigint: expand op tests to cover all val/ref combinations
2015-11-16 11:06:39 -08:00
Josh Stone
978d14aa56
bigint: refactor BigInt ops
...
Try to let the underlying BigUint op implement val/ref forwarding as
much as possible, to reduce cloning.
2015-11-16 11:04:41 -08:00
Josh Stone
ce3d375b21
bigint: refactor BigUint ops
...
As much as possible, ops are forwarded to val-ref so the LHS memory can
be reused for the result. This reduces the number of clones required.
2015-11-16 10:56:30 -08:00
Josh Stone
7781256041
bigint: use a simple let-Some-pop to truncate zeros
2015-11-16 10:20:42 -08:00
Josh Stone
c310e5da8e
complex: forward ops to val-val
...
Since the Num constraint only requires val-val ops, we ended up cloning
everything in Complex ops when they were forwarded to ref-ref. By using
val-val, we can reduce how often clones are needed.
2015-11-16 10:10:59 -08:00
Josh Stone
b4026b9fec
Update repo and doc links
2015-11-12 18:40:13 -08:00
Homu
93db3998ef
Auto merge of #131 - murarth:str-radix, r=cuviper
...
Improve `to_str_radix` implementation
2015-11-12 03:33:55 +09:00
Homu
879f2c868e
Auto merge of #125 - IvanUkhov:real-arithmetic, r=cuviper
...
Implement arithmetic with real for complex
Hello,
It might be handy to be able to perform basic arithmetic operations in expressions mixing complex numbers and numeric primitives; see #116 . I would be grateful for any feedback, especially regarding the subsets of primitives for which certain operations are implemented.
Regards,
Ivan
2015-11-12 03:03:06 +09:00
Murarth
786541bd24
Improve `to_str_radix` implementation
...
Uses in-place division with `u32` divisor to provide a significant speed
improvement.
2015-11-09 13:50:25 -07:00
Abhishek Chanda
7acad5ac33
Implement some more functions for the complex type
2015-11-05 14:20:37 -08:00
Ivan Ukhov
b57e4a4db4
Implement arithmetic with real for complex
2015-10-31 06:38:38 +01:00
Abhishek Chanda
e5099930e7
Implement is_nan for the complex type
...
Also run the associated test
2015-10-30 15:35:04 -07:00
Josh Stone
49237f6f45
integer: expand tests for gcd min_value()
...
- Use explicit asserts for should-panic tests, since overflow is not
checked in release mode.
- Add positive tests where gcd min_value() can be represented.
- In all cases, test min_value() in both positions.
Closes #127
2015-10-30 00:40:21 -07:00
Josh Stone
642787fbd2
Merge pull request #121 from wrieger93/issue_120
...
Add a function that returns the sign of a BigInt.
2015-10-27 12:13:17 -07:00
Josh Stone
9e5a209dcd
Merge pull request #123 from murarth/ratio-parse-fix
...
Check for zero denominator when parsing Ratio
2015-10-23 10:23:18 -07:00
David Ripton
e86913924e
Remove extra parentheses to fix a warning
...
Removing extra parentheses in a for loop fixes this warning:
src/bigint.rs:1636:18: 1636:31 warning: unnecessary parentheses around `for` head expression, #[warn(unused_parens)] on by default
2015-10-19 09:43:47 -04:00
Murarth
b2767517f4
Check for zero denominator when parsing Ratio
...
Closes #122
2015-10-16 13:10:16 -07:00
Łukasz Niemier
2e4afbc9ba
Merge pull request #112 from Emerentius/master
...
Implement Stein's algorithm for gcd
2015-10-15 13:25:33 +02:00
William Rieger
1eb3deaca8
Add a function that returns the sign of a BigInt.
2015-10-06 00:32:32 -07:00
William Rieger
c715405b30
Add functions and tests.
2015-09-13 18:19:00 -04:00
Emerentius
499def9207
Added tests for gcd
...
compare gcd with euclidean gcd
test panics on gcd(min_val, min_val) and gcd(min_val, 0) for signed integers
2015-09-11 20:33:39 +02:00
Emerentius
59089d9d5c
Made it panic on gcd = min_val in debug mode
...
The additional call to .abs() causes a panic on the min value. There are
no other negative values it can encounter.
Does nothing in release mode
2015-09-11 20:27:06 +02:00
Emerentius
82a6ab2f30
comment corrected
...
referenced a,b, which aren't defined
changed to n,m
2015-09-07 16:50:58 +02:00
Emerentius
e892054813
implement Stein's algorithm for gcd
2015-09-07 03:15:16 +02:00
William Rieger
50d89519a2
Merge branch 'master' into develop
...
Conflicts:
src/complex.rs
2015-09-04 18:56:40 -04:00
William Rieger
ff6a40cc88
Remove reduntant Num trait from an impl.
2015-09-04 17:48:31 -04:00
William Rieger
98b9df622f
Add mathematical functions for complex numbers.
...
For Complex<T: Clone + Float>, the following functions along with
corresponding tests were added:
- exp
- sin, cos, tan
- sinh, cosh, tanh
2015-09-04 02:08:31 -04:00
Gustorn
3ccb4bd6c5
Added Sized trait bound for traits that requite it
...
See rust-lang/rfcs#1214
2015-08-19 19:11:55 +02:00
Alex Crichton
b57accf314
Update to rust nightly
2015-08-10 12:11:56 -07:00
root
4c123a9e71
Make rustc-serialize, bignum, rational, complex into opt-out features
...
Making bignum optional allows skipping the rustc-serialize and rand
dependencies too, and it makes a big difference in num's build time.
With default (all) features, clean build time including dependencies: 27
seconds.
With no default features, clean build time including dependencies (none):
5 seconds.
2015-06-02 23:48:06 +02:00
Alex Crichton
0a7847cd65
Merge pull request #99 from b52/issue-93-float-min-positive
...
Provide generic around f32/f64::MIN_POSITIVE
2015-05-26 07:23:41 -07:00
Oliver Mader
785e07d83c
Re-export `cast` for ergonomic reasons
2015-05-26 15:03:34 +02:00
Oliver Mader
6c9f457712
Provide generic around f32/f64::MIN_POSITIVE
2015-05-26 14:56:43 +02:00
Alex Crichton
a6a399d52e
Enable testing on stable Rust
2015-05-19 09:22:06 -07:00
runarberg
505eb86c18
Added the power method for rational numbers
2015-05-17 18:22:32 +00:00
Josh Triplett
6f2db9b631
Factor out more generic macro to run a macro on each tuple type
2015-04-25 17:03:05 -07:00
Josh Triplett
c6163dac40
traits.rs: Implement Bounded for tuples of Bounded types
...
For example, the following will print (4294967295, 65535):
extern crate num;
use num::traits::Bounded;
fn main() {
let t : (u32, u16) = Bounded::max_value();
println!("{:?}", t);
}
2015-04-25 16:50:03 -07:00
mitchmindtree
63d2e79c1e
Added temporary fix for unstable std from_str_radix method
2015-04-24 15:17:42 +10:00
mitchmindtree
3028d602e6
Fixed issue where unstable version of from_str_radix was being called instead of the local Num trait version
2015-04-24 04:57:37 +10:00
mitchmindtree
f0af39dfae
Removed deprecation attributes that can no longer be used outside of std
2015-04-22 22:27:20 +10:00
Nick Hamann
82aa7c7864
Improve bigint docs.
...
Convert instances of <string literal>.as_bytes() to byte string
literals. Also, add examples for from_bytes_le() and to_bytes_be().
2015-04-15 14:46:07 -05:00
kennytm
fd86a2c531
Make sure PrimInt is actually implemented for the primitive types.
2015-04-05 03:10:40 +08:00
kennytm
24d2f15ccf
Avoid and remove some unstable features.
...
The only #[feature] left for now is the bencher.
2015-04-05 03:09:29 +08:00
Anders Kaseorg
7fb887bffc
Require Neg for Complex conj and inv
...
If T is an unsigned integer type, these methods are guaranteed to
overflow unless the result is actually real, so we should disallow
them for the same reason that Neg was removed from these types.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-04-03 15:10:44 -04:00
Alex Crichton
996128bd4b
Fix some doc tests
2015-04-03 10:26:37 -07:00
Aaron Turon
63c7a25ed9
Update to 1.0.0-beta (stable only)
...
Along the way, this commit also rationalizes the traits a bit more.
Moving to stable required vendoring a couple of minor things (notably,
radix formatting).
2015-04-03 10:17:39 -07:00
Aaron Turon
03db5c9d1b
Vendor deprecated/unstable traits from std::num
...
This commit brings in a load of unstable and/or deprecated traits from
the `std::num` module. These traits provide for some degree of generic
programming over numeric types. They are not stable in `std` mostly
because we want more time to iterate on their design. Moving them to the
`num` crate allows existing code to keep using this functionality as we
do so.
Closes #74
2015-04-02 20:04:38 -07:00
Alex Crichton
fcd3760625
Get tests passing again
2015-04-02 09:37:32 -07:00
Anders Kaseorg
a00fe8b700
Replace FromError with From
...
As per https://github.com/rust-lang/rust/pull/23879 .
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-04-02 06:37:57 -04:00
Alex Crichton
1841c8ace4
Update to rust master
2015-03-29 10:05:02 -07:00
Huon Wilson
c21b7e17d4
Feature gating is strict now.
2015-03-26 12:00:36 +11:00
Matt Brubeck
81a16f4a83
rustc-serialize is now rustc_serialize
2015-03-25 17:48:52 -07:00
Alex Crichton
445fbab108
Fix doc test
2015-03-22 10:43:11 -07:00
Alex Crichton
9848257eae
Update to rust master
2015-03-19 09:57:18 -07:00
Joseph Crail
5a0835d5d7
Replace deprecated range function.
2015-03-19 00:15:55 -04:00
Darin Morrison
8ea4c031dd
Replace #[should_fail] with #[should_panic]
2015-03-17 22:21:25 -06:00
Josh Stone
043a5b2918
pow: avoid unnecessary overflows
...
The code was performing an extra squaring of the base, which might
trigger an arithmetic overflow that doesn't matter to the result. Now
this squaring is only attempted when enough exp remains to need it.
A new doctest tries pow(6u8, 3), where an extra square would exceed 256.
2015-03-07 14:12:50 -08:00
Alex Crichton
817dec99aa
Remove usage of deprecated apis
2015-03-04 09:45:19 -08:00
Steve Jahns
fb6b4ae9df
Rust nightly needs explicit cast from u32 to usize
2015-03-04 09:43:44 -07:00
Austin Bonander
f260a7f565
Upgrade to latest Rust
2015-02-20 10:37:11 -08:00
Huon Wilson
6adaa4de8f
Merge #61 .
2015-02-19 12:46:57 +11:00
Huon Wilson
2a3f2f060d
Fix test.
2015-02-19 12:46:43 +11:00
Sam Payson
609c2e6ef0
Minor changes to silence warnings.
2015-02-18 16:41:28 -08:00
Sam Payson
6a0c32782e
Change `radix` to u32, to build with new rustc.
2015-02-18 16:29:46 -08:00
Alex Crichton
e2f0b0d327
Update to rust master
2015-02-05 08:20:16 -08:00
Alex Crichton
0811c72bac
Bump to 0.1.12
2015-02-03 12:37:01 -08:00
Matt Brubeck
e68ea18edc
Silence unstable feature warnings
2015-02-03 12:32:28 -08:00
Matt Brubeck
42edb63090
Update FromStr and FromStrRadix to return Result
...
Fixes build errors with Rust 1.0.0-nightly.
2015-02-03 12:31:10 -08:00
Matt Brubeck
b324415930
Change Show to Debug
...
Fixes deprecation warning
2015-02-03 11:05:55 -08:00
Gulshan Singh
7ba31bc3a7
Implemented from_bytes and to_bytes
2015-02-01 20:17:34 -05:00
Alex Crichton
c05cd530db
Bump to 0.1.10
2015-01-23 08:54:55 -08:00
Gulshan Singh
f1bfd76bbb
Fixed some typos and added some examples
2015-01-20 19:25:02 -05:00
Renato Zannon
791264ddfc
Rename BigDigit module to big_digit
...
Without this rename, the library fails to compile on Rust master, since rust-lang/rust#21269 has landed.
2015-01-20 17:17:43 -02:00
Alex Crichton
45f5cc39bd
s/bigusize/biguint/
2015-01-09 13:54:32 -08:00
Huon Wilson
139cf8cf66
Bump to 0.1.7.
2015-01-09 22:36:03 +11:00
Alex Crichton
bfa91ee92a
Bump to 0.1.6
2015-01-07 12:09:44 -08:00
gifnksm
8219095e39
update to rust mater
2015-01-05 01:59:44 +09:00
Alex Crichton
ce93a10ed0
Finish update and bump version number
2015-01-03 13:52:06 -08:00
Sven Nilsen
ae3bb3619c
Upgrade to latest Rust
...
A `_0` test fails, but don’t know why
2015-01-03 19:30:05 +01:00
Alex Crichton
c11ff27994
Update to rust master
2015-01-01 09:07:52 -08:00
Alex Crichton
5d4b921537
Fix build warnings
2014-12-23 09:51:08 -08:00
Zbigniew Siciarz
a006968185
Fix Ordering import
2014-12-23 17:12:57 +01:00
Zbigniew Siciarz
22c50901ff
Convert Result to Option in parse_bytes.
...
`str::from_utf8` changed its return type to `Result`, but
`num::FromStrRadix::from_str_radix` still returns an `Option`. In this case
discarding the `Err` variant with `ok()` seems fine to me.
2014-12-23 17:09:22 +01:00
gifnksm
9316be3bc1
update to latest rustc
2014-12-21 19:41:03 +09:00
Chase McCarthy
a7e9e79049
Add semicolons to macro lines
2014-12-18 21:01:24 -05:00
gifnksm
a325a566c6
update to latest rustc
...
Now, arithmetic binary operator traits take operands by value,
but non-copyable types such as `BigUint` should not always moved out when
applying operators.
This commit implements these operators not only for bare structs also
these references.
By-value implementations are forwarded to by-reference implementations
for now. In the future, by-value implementations may be replaced with
more efficient implementations (for example, the implementation that
reuses moved buffers.)
2014-12-16 23:44:16 +09:00
gifnksm
1533fe2017
fix deperecation warning
2014-12-09 23:48:37 +09:00
gifnksm
d89fbbf044
Add `deriving(Copy)` for `Copy`able structs/enums/
2014-12-09 23:46:39 +09:00
Alex Crichton
01cc022174
Merge pull request #36 from steveklabnik/license
...
remove license attribute
2014-12-07 20:48:25 -05:00
Steve Klabnik
253f0bd3f3
don't allow deprecated items.
...
We don't actually use any.
2014-12-07 13:22:01 -05:00
Steve Klabnik
ecc2e5fab7
remove license attribute
2014-12-07 13:20:39 -05:00
gifnksm
b20dda2307
Update to iter stabilization.
...
`AdditiveIterator::sum` and `MultiplicativeIterator::product` now take bare self.
2014-11-27 23:06:06 +09:00
Alex Crichton
39acd8f2fb
Update tests to rust master
2014-11-20 12:21:06 -08:00
gifnksm
233c02030d
Fix for namespaced enums.
2014-11-18 21:09:53 +09:00
gifnksm
29011d14d9
std::from_str::FromStr -> std::str::FromStr
2014-11-17 22:38:12 +09:00
gifnksm
3568298a22
Add `iter` modules for generic number iteration.
...
The codes are imported from the standard library.
2014-11-16 19:37:53 +09:00
gifnksm
2155e7d2ee
Add numeric functions and `traits` module that provide numeric traits for generic
...
mathematcs.
Import numeric traits and functions that were removed from the standard library.
This also implements `AdditiveIterator` and `MultiplicativeIterator` for
`BigUint` and `BigInt`.
closes #28
2014-11-16 19:37:49 +09:00
gifnksm
7a7c5fb2ad
Implements `Encodable` and `Decodable`
...
Fixes #27
2014-11-13 20:54:42 +09:00
Alex Crichton
da2fcbaa0c
Merge pull request #25 from jbcrail/fix-overflow-literal
...
Fix overflowing literal in LCM test.
2014-11-07 23:31:17 -06:00
Joseph Crail
fc984d4432
Fix overflowing literal in LCM test.
2014-11-07 21:24:49 -05:00
Joseph Crail
e09b009edb
Remove unused imports.
2014-11-07 21:21:23 -05:00
Joseph Crail
40873fb0c6
Fix two non uppercase globals.
2014-11-06 22:47:10 -05:00
gifnksm
272d6edb79
Update to latest rustc
2014-11-06 22:09:03 +09:00
gifnksm
d3fd33a878
Fix lint name warning
2014-11-05 07:32:00 +09:00
gifnksm
163646cd63
Use sliciing_syntax
2014-11-05 07:32:00 +09:00
gifnksm
436f954627
bigint: Refactor the `parse_bytes` and `from_str_radix`.
...
This follows the changes of "Separate string->integer implementation in strconv" (rust-lang/rust@138b76b ).
This allows `parse_bytes` to be removed without breaking `libnum` code.
2014-11-05 07:31:53 +09:00
Jorge Aparicio
ee6501c81a
parse_bytes has been removed, use from_str_radix instead
...
see rust-lang/rust#18536
2014-11-04 09:20:18 -05:00
Joseph Crail
11901f7724
Fix warning about renamed missing doc attribute.
2014-11-01 17:16:43 -04:00
Zbigniew Siciarz
462f7131bc
fail -> panic
2014-10-30 14:20:15 +01:00
Alex Crichton
6c56fe940c
Update to Rust master
...
Closes #17
2014-10-21 09:27:08 -07:00
gifnksm
f1d975b6f1
Migrate to new `cfg` attribute syntax`
2014-10-10 22:56:15 +09:00
gifnksm
ac37b913d9
Fix `non_uppercase_statics` warnings of private constants.
2014-10-10 22:54:30 +09:00
gifnksm
2fe050c471
Convert statics to constants
2014-10-10 22:50:22 +09:00
Jorge Aparicio
dc3fed0add
Rename `Zero` variant to `NoSign`
2014-09-20 19:58:59 -05:00
Joseph Crail
d9b56348c6
Fix regression and overflow bug for rationals.
2014-09-17 22:23:07 -04:00
Aaron Turon
482f0e0b74
Initial seeding from rust repo
2014-09-16 10:35:35 -07:00