Commit Graph

283 Commits

Author SHA1 Message Date
Trevor Spiteri b46789da36 divide inherent methods into impl<Frac> and impl<Frac: LeEqU*> 2019-08-17 16:35:25 +02:00
Trevor Spiteri 943dc6abe2 remove deprecated functions from README examples 2019-08-16 23:42:29 +02:00
Trevor Spiteri 9e671fced6 version 0.4.2 2019-08-16 23:25:19 +02:00
Trevor Spiteri 9ec8927ad5 add consts::FRAC_TAU_12, as 30 degrees is a useful constant 2019-08-16 23:09:13 +02:00
Trevor Spiteri 71a38079a3 use 6 significant digits in docs for constants 2019-08-16 23:01:27 +02:00
Trevor Spiteri c6cacadfa0 use imports throughout doc examples 2019-08-16 22:57:31 +02:00
Trevor Spiteri 637a87524c impl LossyFrom for infallible conversions from integer to integer 2019-08-16 21:59:44 +02:00
Trevor Spiteri 7b3b76f78c simplify code for many method calls 2019-08-16 21:16:55 +02:00
Trevor Spiteri 8adaa2b5d1 add missing impl LossyFrom<bool> for Fixed which can represent 1 2019-08-16 20:31:41 +02:00
Trevor Spiteri 5d87acd2d3 clean up code in convert.rs 2019-08-16 20:27:57 +02:00
Trevor Spiteri 5e44537bc6 inline function 2019-08-16 17:17:22 +02:00
Trevor Spiteri 87390efaa3 deprecate sealed module 2019-08-16 16:54:16 +02:00
Trevor Spiteri 875305bdc3 remove Frac: LeEqU bounds from struct Fixed, leave them for impl 2019-08-16 15:58:10 +02:00
Trevor Spiteri 9eab1c5be9 add {from,to}_num, deprecate sealed::{Int,Float,Fixed}
* new methods from_num, to_num, and their checked versions
  * deprecate all other from_* and to_*, except for the FromFixed and
    ToFixed traits
  * deprecate sealed::{Fixed,Int,Float}
  * removed SealedFixed, replace Sealed{Int,Float} with
    {Int,Float}Helper
2019-08-16 15:45:26 +02:00
Trevor Spiteri 91a1f1554b add struct ToFixedHelper 2019-08-15 22:49:44 +02:00
Trevor Spiteri aac10de995 add from* methods to Wrapping 2019-08-15 14:38:27 +02:00
Trevor Spiteri b9d6cee72d fmt 2019-08-14 16:56:50 +02:00
Trevor Spiteri 48c7f3421a silence unhelpful clippy::type_repetition_in_bounds 2019-08-14 16:00:57 +02:00
Trevor Spiteri 4a5333416b use byte slices instead of str slices in from_str.rs 2019-08-14 14:00:14 +02:00
Trevor Spiteri b98271c5fb add comment and remove duplications for DecToBin 2019-08-14 13:25:33 +02:00
Trevor Spiteri 0e3ce95394 add comment on generating test strings in check_exact_decimal 2019-08-13 20:06:40 +02:00
Trevor Spiteri e740a88547 very long decimal fraction strings are now parsed correctly 2019-08-13 19:01:01 +02:00
Trevor Spiteri 83ef24b241 use types::* instead of redefining them in tests in lib.rs 2019-08-12 16:56:16 +02:00
Trevor Spiteri 4db3c0c682 style: remove err! macro in from_str 2019-08-12 16:51:30 +02:00
Trevor Spiteri ea84e11808 version 0.4.1 2019-08-12 14:25:51 +02:00
Trevor Spiteri 6fefffd383 use nbits, not dump_bits, as parameter in conversion fns in from_str 2019-08-12 14:23:07 +02:00
Trevor Spiteri d58a2009e0 remove duplicate get_frac128/get_frac* code in from_str 2019-08-12 13:52:08 +02:00
Trevor Spiteri 0840c4fcf0 skip TryFrom doc test if TryFrom not supported by rustc 2019-08-12 13:16:50 +02:00
Trevor Spiteri 49eca656df trim zeros in from_str::parse_bounds 2019-08-12 13:06:15 +02:00
Trevor Spiteri f8196b89a1 add examples to traits::Fixed 2019-08-12 12:34:01 +02:00
Trevor Spiteri 3447c30260 tweak 2019-08-12 01:01:18 +02:00
Trevor Spiteri 63cfb09c1c add some compile_fail tests for conversion to isize/usize 2019-08-11 21:48:55 +02:00
Trevor Spiteri 9b37782249 add some compile_fail tests 2019-08-11 21:42:50 +02:00
Trevor Spiteri 61418b3dc7 fix test compilation 2019-08-11 21:22:08 +02:00
Trevor Spiteri d5c0de1f73 simplify conversion trait constraints 2019-08-11 21:08:15 +02:00
Trevor Spiteri 736c513d69 add types::LeEqU* to simplify Frac bounds 2019-08-11 21:08:05 +02:00
Trevor Spiteri b97754dc5e deprecate traits::Fixed::{mul,div,rem}_int, use {Mul,Div,Rem} 2019-08-11 12:13:39 +02:00
Trevor Spiteri 414e63a6dc make it difficult to accidently leak supertraits in sealed traits 2019-08-11 11:23:15 +02:00
Trevor Spiteri 7695b680e3 multiplication-free radix 2, 4, 16 parsing of integer part 2019-08-11 00:09:54 +02:00
Trevor Spiteri 5efb6f4f85 fix some bugs and add some tests from from_str stuff 2019-08-10 22:06:41 +02:00
Trevor Spiteri 3a4a99a380 clippy 2019-08-10 20:37:23 +02:00
Trevor Spiteri 7d9f738b70 reduce comparisons in hex_str_to_bin 2019-08-10 20:34:29 +02:00
Trevor Spiteri af02209c48 add from_str_{binary,octal,hex} to traits::Fixed 2019-08-10 19:14:15 +02:00
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