Josh Stone
8d4b7b3a8d
derive: bump to 0.1.37
2016-10-14 20:52:24 -07:00
Homu
f2aecb591c
Auto merge of #236 - cuviper:proc-macro, r=hauleth
...
derive: update to proc-macro
2016-10-14 03:59:48 +09:00
Josh Stone
97551ade5b
derive: update to proc-macro
2016-10-13 10:31:49 -07:00
Homu
b6db1eace9
Auto merge of #235 - matklad:minor-corrections, r=cuviper
...
Minor, style and comment typo
Just a couple of super minor cosmetic corrections.
2016-10-06 01:30:42 +09:00
Aleksey Kladov
ec6ce78458
Minor, style and comment typo
2016-10-05 18:47:30 +03:00
Josh Stone
f25a3bd51d
0.1.36 bump for num, traits, macros, and the new derive
2016-09-29 23:31:23 -07:00
Homu
019c136b8c
Auto merge of #228 - rust-num:fix/num-macros, r=cuviper
...
Fix `num-macros` `FromPrimitive` implementation
Current solution follow syntax proposed in rust-lang/rfcs#1681.
Tracking issue rust-lang/rust#35900
Close #227
Code broken after change:
- [ ] https://github.com/kdar/gameboy-rs
- [ ] https://github.com/lemonrock/mbedtls
- [ ] https://github.com/timorantalaiho/kelaa
- [ ] https://github.com/dylanede/cef-rs
- [ ] https://github.com/klutzy/aheui-llvm
- [ ] https://github.com/pcwalton/rust-media
- [ ] https://github.com/PistonDevelopers/hematite_server
2016-09-30 14:58:47 +09:00
Łukasz Jan Niemier
b7e64074b2
Add new crate num-derive as an new replacement for num-macro
2016-09-28 13:33:13 +02:00
Łukasz Jan Niemier
0c89b893a9
Add compiletest crate to test against invalid derivations
2016-09-27 11:18:27 +02:00
Łukasz Jan Niemier
b038b79900
Merge remote-tracking branch 'origin/master' into fix/num-macros
2016-09-26 20:45:49 +02:00
Łukasz Jan Niemier
ada17a1793
Update to syn 0.6.0
2016-09-26 20:32:46 +02:00
Homu
338e4799e6
Auto merge of #231 - AtheMathmo:generic-epsilon, r=hauleth
...
Implementing epsilon function to retrieve EPSILON constant
Hey!
This PR exposes a new `epsilon` function in the `Float` trait so that users can access the `EPSILON` constant on the float types. I figured as this was such a minimal change it was easier to get a PR in offering the change then write up an issue.
For me this is a valuable addition. When writing linear algebra or other optimization routines with generic floats we often want to check if some stopping criteria is reached, often something like: `(a - b).abs() < eps`. Having access to a standard _small value_ would make this a little easier.
2016-09-23 04:25:29 +09:00
James Lucas
381942eb4f
Adding default implementation
2016-09-22 19:56:44 +01:00
James Lucas
a64cf66f4c
Implementing epsilon function to retrieve EPSILON constant
2016-09-18 14:36:44 -07:00
Łukasz Jan Niemier
e9768a0a76
Rebase leftovers
2016-09-18 22:45:53 +02:00
Łukasz Jan Niemier
43cfa25426
Add test case for which `syn` currently fails
2016-09-18 22:43:35 +02:00
Łukasz Jan Niemier
11f8289ed4
Fix `num-macros` `FromPrimitive` implementation
...
Current solution follow syntax proposed in rust-lang/rfcs#1681.
Tracking issue rust-lang/rust#35900
Close #227
2016-09-18 22:43:34 +02:00
Homu
a11be641ed
Auto merge of #229 - bluss:fix-macros, r=hauleth
...
Fix num-macros for nightly
Now compatible with rustc 1.13.0-nightly (32571c05c 2016-09-17)
2016-09-19 05:33:27 +09:00
bluss
6cfd6c8d18
Fix num-macros for nightly
...
Now compatible with rustc 1.13.0-nightly (32571c05c 2016-09-17)
2016-09-18 22:24:38 +02:00
Josh Stone
c8ed8ff87b
num, bigint, complex, rational, traits: 0.1.35
2016-08-18 08:28:34 -07:00
Homu
4fb22849b4
Auto merge of #222 - SuperFluffy:serde_0.8, r=cuviper
...
Use serde 0.8
I updated `bigint`, `complex`, and `rational` to use `serde 0.8`, and also fixed deserialization and the `serde` feature as such in the `rational` crate (didn't add any tests, but it compiles now).
Similar to https://github.com/rust-num/num/pull/196 for `num/complex`, “`use serde;`” needed to be removed in `num/rational`.
2016-08-18 06:24:42 +09:00
Richard Janis Goldschmidt
4f6f7b3292
Add travis build test of 0.7.0 channel
2016-08-17 23:12:20 +02:00
Homu
b0fbcedfa0
Auto merge of #223 - SuperFluffy:fix_import_serde, r=cuviper
...
Fix import serde and rational deserialization
Similar to #196 for num/complex, “use serde;” needed to be removed in num/rational.
Also, deserialization of `num/rational` needed to be fixed by adding type annotations.
This is in response to https://github.com/rust-num/num/pull/222#issuecomment-239957062 of issue https://github.com/rust-num/num/pull/222 .
Also added a travis line, in response to https://github.com/rust-num/num/pull/222#issuecomment-239957062 . Hope it works.
2016-08-18 03:59:26 +09:00
Richard Janis Goldschmidt
a4ccb797cf
Allow serde version in [0.7,0.9)
2016-08-17 12:20:08 +02:00
Richard Janis Goldschmidt
eb486e8dc1
Add build test for serde feature
2016-08-17 12:19:51 +02:00
Richard Janis Goldschmidt
20360ebccf
Fix deserialization by giving type annotations.
2016-08-17 12:05:09 +02:00
Richard Janis Goldschmidt
7339d6cb9a
Remove redundant `use serde`; it is an external crate.
2016-08-17 12:05:09 +02:00
Homu
ccdf307cee
Auto merge of #220 - IvanUkhov:constant, r=cuviper
...
Add a trait for floating-point constants
The pull request is to address issue #194 . In order to keep the library organized, I’ve introduced a new trait for the new functionality. The trait is supposed to closely follows the [`consts`](https://doc.rust-lang.org/std/f64/consts/index.html ) module from the standard library. There are at least the following three open questions:
1. What should the name of the trait be? Currently, it’s `Constant`; an alternative is `Consts`.
2. What should the names of the getters be? Currently, they are lower-case versions of the constants defined in the `consts` module. Note that `Float` provides `log2` and `log10`, whereas `LOG_2` and `LOG_10` get translated into `log_2` and `log_10`, respectively.
3. Should `Float` require the new trait? Or should it be left up to the user?
Please let me know what you think. Thank you!
Regards,
Ivan
2016-08-16 10:29:20 +09:00
Ivan Ukhov
01aad702af
Add a trait for floating-point constants
2016-08-15 06:38:08 +02:00
Homu
10a57ef1a6
Auto merge of #219 - cuviper:tiny-inline, r=hauleth
...
Inline small functions, especially wrappers
We already had `#[inline]` throughout a lot of the code, but notably some
functions which simply wrap inherent methods were not inlined. That means
external references will get a full function call, when they could have been
optimized to as little as one opcode.
This PR inlines all functions that look tiny enough for this to matter.
Fixes #218 .
2016-08-11 19:56:12 +09:00
Josh Stone
5c3d759d6c
bigint: inline bits() methods
2016-08-10 22:23:28 -07:00
Josh Stone
932e45c207
traits: inline integer from_str_radix
2016-08-10 22:22:53 -07:00
Josh Stone
7a9c39fa87
traits: inline Bounded tuple methods
2016-08-10 22:22:15 -07:00
Josh Stone
fa451ac00c
traits: inline Saturating methods
2016-08-10 22:21:53 -07:00
Josh Stone
eefa2a85d0
traits: inline Float methods
2016-08-10 22:21:33 -07:00
Josh Stone
7bc7ddfc87
traits: inline PrimInt methods
2016-08-10 22:21:00 -07:00
Homu
d9f08cb148
Auto merge of #213 - ExpHP:ratio-pr3, r=cuviper
...
rational: recip bugfix and documentation tweaks
Cherry picked from #210 (minus the `new_raw` stuff), with small additions [in a third commit](32dee9a0c8
).
2016-07-25 14:00:23 +09:00
Michael Lamparski
32dee9a0c8
rational: small additional tweaks
...
Move `new` to top to make it more visible in the docs.
Replace instances of $x == Zero::zero()$ with $x.is_zero()$,
partially addressing #11 .
2016-07-24 14:58:43 -04:00
Michael Lamparski
8c75506f22
Ratio::recip now corrects sign and fails for zero
2016-07-24 14:54:06 -04:00
Michael Lamparski
c84c4d15ba
Improve Ratio docs
...
Closes #208 . Clarifies the rounding behavior of some methods and
makes formatting more uniform.
2016-07-24 14:34:55 -04:00
Josh Stone
29c5ab362d
traits: bump to 0.1.34
2016-07-24 11:16:11 -07:00
Homu
f1574d844b
Auto merge of #212 - cuviper:float-deg-rad, r=cuviper
...
traits: add `to_degrees` and `to_radians` on `Float`
To avoid a breaking change, these have crude default implementations as
well as better implementations for `f32` and `f64` in particular. They
don't use the inherent methods though, because `f32` didn't stabilize
those until Rust 1.7.
Fixes #211
2016-07-24 09:56:25 +09:00
Josh Stone
0faeb31b09
traits: add `to_degrees` and `to_radians` on `Float`
...
To avoid a breaking change, these have crude default implementations as
well as better implementations for `f32` and `f64` in particular. They
don't use the inherent methods though, because `f32` didn't stabilize
those until Rust 1.7.
Fixes #211
2016-07-23 00:34:14 -07:00
Homu
ad5a322868
Auto merge of #207 - koverstreet:master, r=cuviper
...
bigint: Break out into multiple files
2016-07-19 09:07:17 +09:00
Kent Overstreet
279522316c
bigint: Break out into multiple files
2016-07-18 15:56:03 -08:00
Homu
78bad13948
Auto merge of #204 - koverstreet:master, r=cuviper
...
Minor optimization, prep work for more optimization
The patch "drop some dependencies on BigDigit's size" is the one I'd really like to get in.
2016-07-15 15:36:44 +09:00
Kent Overstreet
8e0baecf5c
Drop some dependencies on BigDigit's size
...
Before:
test divide_0 ... bench: 1,011 ns/iter (+/- 184)
test divide_1 ... bench: 18,535 ns/iter (+/- 770)
test divide_2 ... bench: 990,467 ns/iter (+/- 91,980)
test fac_to_string ... bench: 1,275 ns/iter (+/- 60)
test factorial_100 ... bench: 6,453 ns/iter (+/- 101)
test fib_100 ... bench: 1,142 ns/iter (+/- 99)
test fib_1000 ... bench: 18,713 ns/iter (+/- 2,172)
test fib_10000 ... bench: 1,197,965 ns/iter (+/- 21,178)
test fib_to_string ... bench: 225 ns/iter (+/- 13)
test from_str_radix_02 ... bench: 3,460 ns/iter (+/- 626)
test from_str_radix_08 ... bench: 1,324 ns/iter (+/- 24)
test from_str_radix_10 ... bench: 1,488 ns/iter (+/- 19)
test from_str_radix_16 ... bench: 969 ns/iter (+/- 22)
test from_str_radix_36 ... bench: 1,135 ns/iter (+/- 23)
test hash ... bench: 102,126 ns/iter (+/- 1,016)
test multiply_0 ... bench: 353 ns/iter (+/- 74)
test multiply_1 ... bench: 31,006 ns/iter (+/- 679)
test multiply_2 ... bench: 3,438,143 ns/iter (+/- 47,640)
test pow_bench ... bench: 7,457,045 ns/iter (+/- 96,175)
test shl ... bench: 5,627 ns/iter (+/- 121)
test shr ... bench: 5,054 ns/iter (+/- 112)
test to_str_radix_02 ... bench: 2,774 ns/iter (+/- 88)
test to_str_radix_08 ... bench: 980 ns/iter (+/- 425)
test to_str_radix_10 ... bench: 3,029 ns/iter (+/- 115)
test to_str_radix_16 ... bench: 788 ns/iter (+/- 14)
test to_str_radix_36 ... bench: 8,285 ns/iter (+/- 175)
After:
test divide_0 ... bench: 925 ns/iter (+/- 30)
test divide_1 ... bench: 17,660 ns/iter (+/- 379)
test divide_2 ... bench: 972,427 ns/iter (+/- 7,560)
test fac_to_string ... bench: 1,260 ns/iter (+/- 36)
test factorial_100 ... bench: 7,077 ns/iter (+/- 204)
test fib_100 ... bench: 1,124 ns/iter (+/- 32)
test fib_1000 ... bench: 18,475 ns/iter (+/- 166)
test fib_10000 ... bench: 1,192,748 ns/iter (+/- 27,128)
test fib_to_string ... bench: 228 ns/iter (+/- 10)
test from_str_radix_02 ... bench: 3,379 ns/iter (+/- 74)
test from_str_radix_08 ... bench: 1,355 ns/iter (+/- 24)
test from_str_radix_10 ... bench: 1,470 ns/iter (+/- 20)
test from_str_radix_16 ... bench: 958 ns/iter (+/- 239)
test from_str_radix_36 ... bench: 1,137 ns/iter (+/- 19)
test hash ... bench: 102,730 ns/iter (+/- 39,897)
test multiply_0 ... bench: 351 ns/iter (+/- 15)
test multiply_1 ... bench: 31,139 ns/iter (+/- 1,053)
test multiply_2 ... bench: 3,464,509 ns/iter (+/- 124,235)
test pow_bench ... bench: 7,448,428 ns/iter (+/- 326,903)
test shl ... bench: 5,784 ns/iter (+/- 190)
test shr ... bench: 4,820 ns/iter (+/- 63)
test to_str_radix_02 ... bench: 2,757 ns/iter (+/- 33)
test to_str_radix_08 ... bench: 989 ns/iter (+/- 67)
test to_str_radix_10 ... bench: 3,045 ns/iter (+/- 70)
test to_str_radix_16 ... bench: 787 ns/iter (+/- 24)
test to_str_radix_36 ... bench: 8,257 ns/iter (+/- 117)/
2016-07-14 21:56:16 -08:00
Josh Stone
e67d4630a2
num: require newer traits for moved functions, fixes #206
2016-07-12 23:24:45 -07:00
Josh Stone
29b63410ac
num: bump to 0.1.33
2016-07-12 01:12:41 -07:00
Josh Stone
18b3cb425d
complex: bump to 0.1.33
2016-07-12 01:10:37 -07:00