Commit Graph

424 Commits

Author SHA1 Message Date
Trevor Spiteri 68c0fa6f8d include generator in consts.rs 2020-04-16 23:05:53 +02:00
Trevor Spiteri 5db3b17284 fix comparison of e.g. I0F16 with +0.5 2020-04-16 21:19:30 +02:00
Trevor Spiteri 4c25f002a1 update copyright date 2020-04-13 20:11:39 +02:00
Trevor Spiteri 36ef9cae03 use macro to avoid repetitions in log10 tests 2020-04-13 18:12:56 +02:00
Trevor Spiteri f038d17921 some log10 cleanups 2020-04-13 05:23:29 +02:00
Trevor Spiteri de69767a3c fmt 2020-04-13 04:28:23 +02:00
Trevor Spiteri b0f6deab9e some log10 optimizations 2020-04-13 04:27:36 +02:00
Trevor Spiteri a32b56ab43 add int_log10 and checked_int_log10 2020-04-13 03:17:21 +02:00
Trevor Spiteri 919519fea1 doc nits 2020-04-13 00:27:42 +02:00
Trevor Spiteri e8f3ff2c67 replace {min,max}_value() by {MIN,MAX} in examples
There are hidden import lines

    use std::primitive;

that should be removed once MIN and MAX are supported by the minimum
supported rustc.
2020-04-11 19:23:58 +02:00
Trevor Spiteri 47287ab98f replace {int,frac}_nbits() by {INT,FRAC}_NBITS 2020-04-11 18:50:26 +02:00
Trevor Spiteri e1febebb31 replace {min,max}_value() by {MIN,MAX} 2020-04-11 18:34:52 +02:00
Trevor Spiteri 91bd73bca4 add int_log2 and checked_int_log2 2020-04-11 17:44:09 +02:00
Trevor Spiteri 060b58af13 doc: use [`true`] instead of [`true`][`bool`]
This is because link markdown is not interpreted in search results, so
at least bool is not displayed.
2020-04-11 16:54:22 +02:00
Trevor Spiteri b41c726da5 test constant LOG2_10 and LOG10_2
Before this commit, the tests were skipped because the corresponding
standard library constants were unstable, but the values themselves
could easily be computed for the test. Once the minimum rustc
supported becomes 1.43.0, the tests should be changed to use the
constants instead of the computation.
2020-04-08 13:23:04 +02:00
Trevor Spiteri b035ae9dbe typo 2020-04-08 12:51:11 +02:00
Trevor Spiteri 8803e0786d docs: link to F::is_{finite,nan} in impl {To,From}Fixed for F
Before this commit, all links were to the f64 documentation, even for
implementations for f32, f16 and bf16.
2020-03-20 01:59:51 +01:00
Trevor Spiteri f86e59a204 document individual conversion traits 2020-03-05 15:30:08 +01:00
Trevor Spiteri aeac17c0d8 fix failing cmp_parse test
While with the actual string

    f ≤ string < f+Δ

we are using a parsed version, which could be actually larger than
string so that the test should only check

    f ≤ parsed ≤ f+Δ
2020-02-24 14:29:34 +01:00
Trevor Spiteri c6d8e14537 test that constants are truncated version of known correct strings 2020-02-24 14:16:23 +01:00
Trevor Spiteri 327bc05413 specify that <Err = PraseFixedError> in Fixed: FromStr constraint 2020-02-24 14:13:30 +01:00
Trevor Spiteri 524fc0c28f version 0.5.4 2020-02-21 16:34:27 +01:00
Trevor Spiteri 97fdf52ac6 silence clippy 2020-02-21 15:57:56 +01:00
Trevor Spiteri e0f3eb77b8 fix incorrect overflow handling for rem_euclid_int 2020-02-21 15:39:02 +01:00
Trevor Spiteri e8f5a8238e tweak Fixed doc 2020-02-13 15:57:12 +01:00
Trevor Spiteri 5ed4979048 version 0.5.3 2020-02-13 13:48:03 +01:00
Trevor Spiteri 26da6f43bf ci: sort list of cargo cached packages 2020-02-13 13:47:11 +01:00
Trevor Spiteri 4b889cbb1f reorganize {,checked} {,Euclidean} remainders {,by integers}
Now the main logic is in the checked functions, which fail only if rhs
is zero, and the other functions all .expect("division by zero").

checked_rem now uses % instead of core checked_rem.

checked_rem_euclid now uses core rem_euclid.

checked_rem_int uses checked_rem for the most common case.

checked_rem_euclid_int uses checked_rem_euclid for the most common
case.
2020-02-13 12:04:49 +01:00
Trevor Spiteri 68f72f8b56 some fixes and tests
* rem_euclid no longer uses rhs.abs() which could overflow.

  * Rem<Inner> and rem_euclid_int now allow for the signed case where
    rhs is equal to the absolute value of the minimum fixed value.

  * checked_rem_int, checked_rem_euclid and checked_rem_euclid_int now
    check for zero then defer to Rem<Inner>, rem_euclid and
    rem_euclid_int.
2020-02-13 01:39:02 +01:00
Trevor Spiteri 913ea21d4d typo 2020-02-13 00:07:53 +01:00
Trevor Spiteri be49c12e93 typo 2020-02-12 23:58:44 +01:00
Trevor Spiteri 137d8989e6 mention fixed-sqrt in top-level doc 2020-02-12 23:56:26 +01:00
Trevor Spiteri e3e17341f2 add {div,rem}_euclid_int to Wrapping 2020-02-12 23:51:31 +01:00
Trevor Spiteri 873bdfa128 fix bug in round_to_zero 2020-02-12 23:45:58 +01:00
Trevor Spiteri ddf69cdca0 some doc tweaks 2020-02-12 23:18:24 +01:00
Trevor Spiteri 3ee5811556 fix remaining checked {div,rem}_euclid_int methods
Closes https://gitlab.com/tspiteri/fixed/issues/13
2020-02-12 18:40:04 +01:00
Trevor Spiteri 97128d2b9f fix checked_rem_int and fix+deprecate {wrapping,overflowing}_rem_int
https://gitlab.com/tspiteri/fixed/issues/13
2020-02-12 17:32:34 +01:00
Trevor Spiteri 677ee97f6f add more arithmetic tests 2020-02-12 16:59:10 +01:00
Trevor Spiteri f8d2004c8f fix Rem<Inner> for Fixed
https://gitlab.com/tspiteri/fixed/issues/13
2020-02-12 16:58:21 +01:00
Trevor Spiteri f070f5e75a more of remove Frac constraints for trait impls that do not need it 2020-02-12 16:44:26 +01:00
Trevor Spiteri f6f4b9d174 add {div,rem}_euclid to Wrapping 2020-02-12 15:07:15 +01:00
Trevor Spiteri bf7c2024e1 add {saturating,wrapping,overflowing}_div_euclid 2020-02-12 14:48:10 +01:00
Trevor Spiteri 43926daa62 add checked_{div,rem}_euclid 2020-02-12 14:16:19 +01:00
Trevor Spiteri 96e922d287 remove Frac constraints for trait impls that do not need it 2020-02-12 13:57:20 +01:00
Trevor Spiteri 6e93affa0d add div_euclid and rem_euclid 2020-02-12 13:48:35 +01:00
Trevor Spiteri c2fa7448c2 implement Rem and RemAssign, and add checked_rem
Closes https://gitlab.com/tspiteri/fixed/issues/12
2020-02-12 13:15:23 +01:00
Trevor Spiteri 2f2b05e33f version 0.5.2 2020-02-02 21:02:14 +01:00
Trevor Spiteri fc045ae224 Merge branch 'serdeize-wrapping' into 'master'
add serde impls for Wrapping types

See merge request tspiteri/fixed!5
2020-02-01 11:52:33 +00:00
Shane Pearman b0e3828e79 re-use inner serde impls for Wrapping types 2020-02-01 03:01:11 -08:00
Shane Pearman 7aa5b0844f add serde impls for Wrapping types 2020-02-01 01:26:35 -08:00