Commit Graph

733 Commits

Author SHA1 Message Date
Wictor Lund de91d5d9e3 Added trait From<T> for Ratio<T> where T: Clone + Integer 2016-12-01 21:38:53 +02:00
Josh Stone be61427d03 derive: bump to 0.1.38 2016-11-28 09:46:18 -08:00
Josh Stone 7ebef5bbe6 macros: update string interning 2016-11-28 09:41:18 -08:00
Josh Stone d7cbdb509c Merge pull request #242 from rust-num/feat/do-not-duplicate-enum-definition
Fix code duplication error

(Overriding a CI failure due to `num-macros`.)
2016-11-28 09:39:36 -08:00
Łukasz Jan Niemier 20243f5baa
fix(num_derive): code duplication error
Fixes #240
2016-11-27 19:31:33 +01:00
Homu 8489f0c388 Auto merge of #239 - bluss:doc-root-url, r=cuviper
Add doc(html_root_url) and other doc attrs to each crate

Also update to use https instead of http. This avoids mixed content
degradation on docs.rs.

The doc root URLs are correct as they are, the URL does not include the
crate name itself.
2016-11-05 02:33:34 +09:00
bluss ff2a350e98 Use the integer32 playground 2016-11-02 19:51:10 +01:00
bluss e4a6956e5a Add doc(html_root_url) and other doc attrs to each crate
Also update to use https instead of http. This avois mixed content
degradation on docs.rs.

The doc root URLs are correct as they are, the URL does not include the
crate name itself.
2016-11-01 02:14:23 +01:00
Homu 938ec63c95 Auto merge of #238 - bluss:fix-mut, r=cuviper
traits: Remove pattern in trait's method signature

This use of `mut` was nonsensical for now, but is proposed to be
disallowed by rustc in the future (as a bugfix).

See rust-lang/rust/pull/37378 for context.
2016-10-25 08:05:35 +09:00
bluss 96e96ef762 Remove pattern in trait's method signature
This use of `mut` was nonsensical for now, but is proposed to be
disallowed by rustc in the future (as a bugfix in Rust).
2016-10-25 00:42:44 +02:00
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