Trevor Spiteri
4187d84e41
add octal and hex
2019-08-10 19:07:57 +02:00
Trevor Spiteri
f8630a63f6
fix some bugs in from_str
2019-08-10 18:13:36 +02:00
Trevor Spiteri
9f881db399
implement from_str_bin
2019-08-10 16:46:44 +02:00
Trevor Spiteri
852040e876
simplify from_str and start adding support for 2, 8, 16 radixes
2019-08-10 15:34:49 +02:00
Trevor Spiteri
e6f64a44b2
optimize from_str when frac_nbits < nbits/2 or int_nbits < nbits/2
...
* get_frac128 will call get_frac64 if frac_nbits <= 64
* get_frac64 will call get_frac32 if frac_nbits <= 32
* get_frac32 will call get_frac16 if frac_nbits <= 16
* get_frac16 will call get_frac8 if frac_nbits <= 8
* get_frac8 has to do the work itself
* similar for get_int_{u128,u64,u32,u16}, get_int_{i128,i64,i32,i16}
2019-08-10 00:19:36 +02:00
Trevor Spiteri
9674a05d7f
expose ParseFixedError
2019-08-09 23:35:34 +02:00
Trevor Spiteri
76a8e07f54
use parse::<primitives> instead of naive multiply accumulate
2019-08-09 23:13:44 +02:00
Trevor Spiteri
5459750f6d
use parse::<u128> instead of naive multiply accumulate
2019-08-09 23:06:51 +02:00
Trevor Spiteri
1a9816486c
add FromStr supertrait to traits::Fixed
2019-08-09 22:38:09 +02:00
Trevor Spiteri
03b26d5675
implement FromStr for Fixed{I128,U128}
2019-08-09 22:34:13 +02:00
Trevor Spiteri
ae92706f1d
implement FromStr for Fixed{I32,U32,I64,U64}
2019-08-09 21:52:16 +02:00
Trevor Spiteri
34b14cd4e9
generatlize FromStr from Fixed{I8,U8} and do Fixed{I16,U16}
2019-08-09 21:04:36 +02:00
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