Commit Graph

353 Commits

Author SHA1 Message Date
Trevor Spiteri daa600bb71 properly handle precision in Display 2019-08-19 23:53:43 +02:00
Trevor Spiteri 2d5a5c3ada properly handle precision in Binary, Octal, LowerHex, UpperHex 2019-08-19 18:49:40 +02:00
Trevor Spiteri 76a0abe468 relax some trait bounds in Wrapping
* Now bitwise and shifting operations do not require F: Fixed, only
    F: Op. For example

        impl BitAnd<Wrapping<F>> for Wrapping<F>

    is now bound by

        where F: BitAnd<F, Output = F>

    instead of

        where F: Fixed

  * Also multiplication and division by integers do not require Frac
    bounds. For example

        impl Mul<i8> for Wrapping<FixedI8<Frac>>

    now has no bounds on Frac, instead of being bound by

        where Frac: LeEqU8
2019-08-19 14:15:06 +02:00
Trevor Spiteri a501829cc6 change rhs type of Wrapping shift operators from usize to u32 2019-08-19 13:18:54 +02:00
Trevor Spiteri 960a782799 consolidate the trait impls for Wrapping 2019-08-19 02:02:06 +02:00
Trevor Spiteri 02255757b4 Wrapping::from_str was moved to impl FromStr 2019-08-19 01:16:53 +02:00
Trevor Spiteri 86c04e4830 rename Wrapping::wrapping_from_str* -> Wrapping::from_str* 2019-08-19 01:01:30 +02:00
Trevor Spiteri a2249ea232 add {saturating,wrapping_overflowing}_from_str{,_binary,_octal,_hex} 2019-08-19 00:30:02 +02:00
Trevor Spiteri 8bd4d5e9a7 add support for wrapping from_str_radix 2019-08-19 00:07:57 +02:00
Trevor Spiteri 995fe63f8a fix tests on rustc 1.34 2019-08-18 01:14:35 +02:00
Trevor Spiteri cba3907e37 from_str now rounds ties to even 2019-08-17 23:57:39 +02:00
Trevor Spiteri b15a1e8ef0 from_str_{binary,octal,hex} now rounds ties to even 2019-08-17 21:46:50 +02:00
Trevor Spiteri 1ba116110c fix link in 0.4.3 news 2019-08-17 18:48:56 +02:00
Trevor Spiteri 07ea3ff1ae use constants {INT,FRAC}_NBITS instead of methods where possible 2019-08-17 18:21:04 +02:00
Trevor Spiteri 3f7d1f42a5 simplify consts.rs 2019-08-17 18:15:36 +02:00
Trevor Spiteri 28885e09ab make INT_NBITS and FRAC_NBITS constants public 2019-08-17 17:55:50 +02:00
Trevor Spiteri 27f3da832f do not test for TryFrom in build.rs as rustc 1.34.0 is now required 2019-08-17 17:17:31 +02:00
Trevor Spiteri 1a859f2033 20 more const functions 2019-08-17 17:10:55 +02:00
Trevor Spiteri 0e96ea1243 depend on rustc 1.34.0 (for some const functions) 2019-08-17 16:52:08 +02:00
Trevor Spiteri 2518b6b147 make const functions: min_value, max_value, from_bits, to_bits 2019-08-17 16:45:09 +02:00
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