Commit Graph

328 Commits

Author SHA1 Message Date
Trevor Spiteri 05980077b7 start FromStr implementation
FixedI8 and FixedU8 are done, and most of the work of the fractional
bit decoding is done as well.
2019-08-09 20:18:55 +02:00
Trevor Spiteri c64a2fce0a version 0.4.0 2019-08-08 23:25:05 +02:00
Trevor Spiteri a4b243ce7e remove deprecated methods 2019-08-08 22:47:49 +02:00
Trevor Spiteri 25274e9ae1 implement LossyFrom<F> for isize/usize when F::int_nbits() <= 16 2019-08-08 22:35:23 +02:00
Trevor Spiteri cfca5d1f0b clippy 2019-08-08 20:41:40 +02:00
Trevor Spiteri 8b3c6c624d Fix unhandled overflow in previous commit.
Also work around https://github.com/rust-lang/rust/issues/63384
2019-08-08 20:28:12 +02:00
Trevor Spiteri b9e92b5d95 simplify fraction to string 2019-08-08 14:48:46 +02:00
Trevor Spiteri e0a4f2a606 add *{from,to}_{int,float} to traits::Fixed 2019-08-07 01:09:40 +02:00
Trevor Spiteri 3d8eaaac64 inline very simple "where"s 2019-08-07 00:31:25 +02:00
Trevor Spiteri d0faad2c0a add Fixed supertraits depending on crate features 2019-08-07 00:01:33 +02:00
Trevor Spiteri 75ec7dd013 more supertraits for traits::Fixed: PartialOrd<primitives> 2019-08-07 00:01:12 +02:00
Trevor Spiteri 7ead73794c Neg supertrait of FixedSigned not Fixed 2019-08-06 23:03:27 +02:00
Trevor Spiteri 5802e2a6e9 more consistent imports 2019-08-06 22:54:21 +02:00
Trevor Spiteri eae97c6b14 make traits::Fixed more comprehensive
Lots of supertraits, add {mul,div,rem}_int
2019-08-06 22:48:13 +02:00
Trevor Spiteri 5bffc02836 link tuple in docs 2019-08-06 22:43:02 +02:00
Trevor Spiteri 4f1a9b3bd3 tweaks 2019-08-06 21:56:47 +02:00
Trevor Spiteri b4baf7d15f signum wraps in release mode 2019-08-06 21:56:43 +02:00
Trevor Spiteri 1a292a4245 appease clippy 2019-08-06 20:54:21 +02:00
Trevor Spiteri beecc9d934 fix tests without f16 2019-08-06 20:52:24 +02:00
Trevor Spiteri a7ffa79849 add tau constants 2019-08-06 20:47:21 +02:00
Trevor Spiteri f5cbc00d28 add const -> float tests 2019-08-06 19:45:13 +02:00
Trevor Spiteri ac09c05126 doc tweak 2019-08-06 19:39:52 +02:00
Trevor Spiteri 0ebf6a87a0 add consts module 2019-08-06 18:53:41 +02:00
Trevor Spiteri 1d13dfa7a1 implement almost all methods in Fixed{,Signed,Unsigned} traits
Conversions that can be handled using FromFixed and toFixed are not
included.
2019-08-06 16:43:39 +02:00
Trevor Spiteri 3f7822b7e5 add saturating_neg and saturating_abs 2019-08-06 16:35:58 +02:00
Trevor Spiteri e8e5a4b439 doc fixes 2019-08-06 16:12:09 +02:00
Trevor Spiteri 5fa0b53ddc clean up sealed traits and split off new traits::Fixed 2019-08-06 14:40:58 +02:00
Trevor Spiteri 6b2e34971a clippy 2019-08-03 23:48:43 +02:00
Trevor Spiteri 508949c293 Merge branch 'bench' into 'master'
Add Benches

See merge request tspiteri/fixed!2
2019-08-03 21:45:39 +00:00
jean-airoldie 2a62b2b69c Added benchmarks
* Added Add, Sub, Div, Mul benchmarks
* Added criterion, rand and num-traits as dev-dependencies
2019-08-03 16:51:25 -04:00
Trevor Spiteri 77ee24dff3 Do not use a tuple in a tuple struct
https://github.com/rust-lang/rust/issues/63244
2019-08-03 20:11:07 +02:00
Trevor Spiteri 320147370f add Bits, from_bits, to_bits to Fixed trait; and add it to prelude 2019-08-03 17:09:53 +02:00
Trevor Spiteri e9b256979b Merge branch 'prelude' into 'master'
Add a prelude

See merge request tspiteri/fixed!3
2019-08-03 11:37:59 +00:00
jean-airoldie a94621e1d5 Add a prelude
This prelude contains the sealed public types as well as
the conversions traits.
2019-08-03 06:44:42 -04:00
Trevor Spiteri dad1cb298c simplify checked conversions for floats 2019-08-03 02:06:37 +02:00
Trevor Spiteri 91a4ba3de7 mention new rustc requirement in release notes 2019-08-03 01:26:32 +02:00
Trevor Spiteri 99668c5a5e simplify checked conversions for int and fixed
The actual implementations are now in SealedInt and SealedFixed. Both
macros_from_to.rs and sealed.rs directly defer to those
implementations.
2019-08-03 01:17:25 +02:00
Trevor Spiteri 62457d201d Merge branch 'edition_2018' into 'master'
Move to edition 2018

See merge request tspiteri/fixed!1
2019-08-02 23:15:29 +00:00
Trevor Spiteri a028cb07a9 next version will be 0.4.0 because of incompatible change 2019-08-02 19:01:46 +02:00
Trevor Spiteri 66d241ffbe remove duplicate trait methods 2019-08-02 18:57:56 +02:00
jean-airoldie e67a943979 Move to edition 2018
* Bumped minimum rustc version to 1.31.1
2019-08-02 11:19:49 -04:00
Trevor Spiteri 6fb069f0c9 implement LossyFrom<floats> for floats 2019-08-02 16:26:08 +02:00
Trevor Spiteri f2099cc067 implement LossyFrom<integers> for floats 2019-08-02 16:25:38 +02:00
Trevor Spiteri 225a0e8307 update release notes to mention new traits 2019-08-02 15:40:22 +02:00
Trevor Spiteri 34be1ff5e9 rename Checked{From,To}Fixed -> {From,To}Fixed 2019-08-02 15:30:04 +02:00
Trevor Spiteri 360cb1de0b add LossyFrom and LossyInto 2019-08-02 15:28:47 +02:00
Trevor Spiteri 5415502f07 add CheckedFromFixed and CheckedToFixed 2019-08-02 15:28:30 +02:00
Trevor Spiteri 7b6fec9b49 provide *from_fixed and *to_fixed in sealed::Fixed 2019-08-02 12:41:14 +02:00
Trevor Spiteri 56b076fb85 add applicable From implementations for usize/isize 2019-07-04 14:31:45 +02:00
Trevor Spiteri 0d9c301505 slightly cleaner isize/usize support in sealed_int 2019-07-01 10:52:48 +02:00