Commit Graph

72 Commits

Author SHA1 Message Date
Josh Stone 796adf5dfa traits: bump to 0.1.39 2017-06-09 10:56:13 -07:00
Josh Stone fe34d17aaf Revert "Auto merge of #296 - vks:no_std, r=cuviper"
This reverts commit 8b5d4ac24e, reversing
changes made to ef752e4687.
2017-06-09 10:12:50 -07:00
Josh Stone ae438d3608 traits: bump to 0.1.38 2017-06-08 23:42:41 -07:00
Vinzent Steinberg ba73ba2af0 Avoid infinite recursion on `no_std` 2017-06-08 10:02:39 +02:00
Vinzent Steinberg b7d2a99d09 Add word of caution about `Float` and `no_std` 2017-06-07 12:22:26 +02:00
Vinzent Steinberg 63ce0f04ae Don't duplicate `num_traits::pow` 2017-06-07 12:17:16 +02:00
Vinzent Steinberg f8a61962ba Use native `to_degrees`/`to_radians` 2017-06-07 12:05:53 +02:00
Vinzent Steinberg 169105bb84 Implement `Float::{min, max}` for `no_std` 2017-06-02 11:47:46 +02:00
Vinzent Steinberg 6253669ef4 Mark methods in `Float` whether they require `std`
This removes the `BasicFloat` trait.
2017-06-02 11:47:45 +02:00
Vinzent Steinberg 351dfc6383 traits: Introduce std feature
This makes it possible to build `traits` without `std`. For this a new
trait `BasicFloat` was introduced, implementing some basic functionality
that works with `core`. Most notably this is lacking functions like
`cos`, `sin`, etc.

`Float` is not available without `std`.

Refs #216.
2017-05-31 13:44:39 +02:00
Josh Stone 3ead4a16b5 Implement RefNum more generically 2017-05-06 21:35:38 -07:00
Josh Stone 21b520ea15 Add new traits for reference and assignment operators
There are two new "utility" traits covering the basic operators:
`Add`, `Sub`, `Mul`, `Div`, and `Rem`.

- `NumOps<Rhs, Output>`: operators with an arbitrary operand and output.
- `NumAssignOps<Rhs>`: assignment operators with an arbitrary operand.

Then the new collection of numeric traits are:

- `Num`: effectively unchanged, just taking operands by value.
- `NumRef`: `Num` adding reference operands on the right side.
- `RefNum`: `&T` operators, with either `T` or `&T` on the right side.
  - This does not specify `T: Num`, as rust-lang/rust#20671 means that
    could only add a constraint, without implying its presence for use.
- `NumAssign`: `Num` adding assignment operators by value.
- `NumAssignRef`: `NumAssign` adding reference assignment operators.
  - Nothing actually implements this yet!

Acknowledgement: this is roughly based on [@andersk's suggestion][1].

[1] https://github.com/rust-num/num/issues/94#issuecomment-269073071
2017-05-06 21:35:38 -07:00
Yoan Lecoq 9d8c808db6 comment out wrapping_is_signed test to make Rust 1.8 happy 2017-05-01 14:11:10 +02:00
Yoan Lecoq fd50c9196b Added trait bounds tests for Wrapping 2017-05-01 13:42:30 +02:00
Yoan Lecoq 3b7a775f38 Remove Signed Wrapping test because Wrapping doesn't impl Neg in Rust 1.8 2017-04-30 10:45:51 +02:00
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
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 1a66ee9e80 Add licenses to subcrates 2017-02-26 13:39:23 -08:00
Jacob Kiesel c78a48fd35 Improve documentation comments
Remove passive voice from documentation comments.
2017-02-08 15:10:01 -07:00
Jacob Kiesel 17665ec50d Update lib.rs
Make assert debug error more accurate.
2017-02-07 15:03:00 -07:00
Jacob Kiesel f8dcec366b Made requested changes. 2017-02-07 13:02:32 -07:00
Josh Stone 817ab00f64 Merge pull request #256 from nwin/add-wrapping-traits
Added traits for wrapping arithmetics.
2017-02-04 21:47:53 -08:00
nwin 58b7da46d2 Added tests. 2017-02-04 10:42:12 +01:00
Corey Farwell 19109883de Add doc example for `num_traits::Num::from_str_radix`. 2017-01-30 23:42:27 -05:00
nwin 450c0e2760 Correct typos. 2017-01-26 21:12:27 +01:00
nwin ee9d474243 Ensure compatibility with Rust 1.0.0. 2017-01-22 10:13:50 +01:00
nwin d25f53056d Added traits for wrapping arithmetics.
Added `Wrapping` traits for the most common operations. Similar to the already present `Checked` traits.
2017-01-22 09:45:35 +01: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
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 f25a3bd51d 0.1.36 bump for num, traits, macros, and the new derive 2016-09-29 23:31:23 -07: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