Trevor Spiteri
a99655c809
implement az casts with both source and destination as fixed-point
2019-10-10 19:28:42 +02:00
Trevor Spiteri
b6c1974401
clippy
2019-10-10 17:19:10 +02:00
Trevor Spiteri
cfe198f087
document and test az option
2019-10-10 17:13:36 +02:00
Trevor Spiteri
d6c634c915
make az support optional
2019-10-10 17:13:27 +02:00
Trevor Spiteri
019c1eeb23
add az support
2019-10-10 16:47:10 +02:00
Trevor Spiteri
3248e354ba
version 0.4.5
2019-08-30 22:32:17 +02:00
Trevor Spiteri
687a5521a7
Wrapping nits
2019-08-30 21:55:26 +02:00
Trevor Spiteri
e5afe1d6a4
add more tests in {display,from_str}.rs
2019-08-30 21:30:40 +02:00
Trevor Spiteri
1960c702c6
remove unnecessary helper methods
2019-08-30 21:28:19 +02:00
Trevor Spiteri
55a58bf795
typos
2019-08-30 13:01:42 +02:00
Trevor Spiteri
a4c3fdeeed
add methods to Wrapping
2019-08-30 12:48:31 +02:00
Trevor Spiteri
e31802dd23
some more display/from_str tests
2019-08-29 22:30:56 +02:00
Trevor Spiteri
24f197b930
remove unnecessary macros
2019-08-29 17:24:36 +02:00
Trevor Spiteri
75df9749ff
add compare_frac17_float test
2019-08-29 14:20:56 +02:00
Trevor Spiteri
1a81cef6eb
improve test for previous commit
2019-08-29 12:38:22 +02:00
Trevor Spiteri
f314735cc9
bug fix: decimal display panics or includes leading zero
2019-08-29 11:50:18 +02:00
Trevor Spiteri
de6ecb5782
add Wrapping::round_ties_to_even
2019-08-29 10:12:17 +02:00
Trevor Spiteri
0711850c26
doc nits
2019-08-26 11:10:07 +02:00
Trevor Spiteri
980804b1c7
do not use cfg_attr for clippy allows
2019-08-24 16:35:03 +02:00
Trevor Spiteri
ee98c16b28
simplify ceil_log10_2_times
2019-08-24 16:32:28 +02:00
Trevor Spiteri
06af80c9ed
nits
2019-08-24 14:52:32 +02:00
Trevor Spiteri
50ca556686
version 0.4.4
2019-08-24 13:15:28 +02:00
Trevor Spiteri
82c7781f0e
update README and doc main page
2019-08-24 13:10:49 +02:00
Trevor Spiteri
97e57bad0e
fix unused warning
2019-08-23 14:16:36 +02:00
Trevor Spiteri
c6e0563257
clippy + fmt
2019-08-23 14:06:28 +02:00
Trevor Spiteri
72f619b757
do not use f16::from_{f32,f64} from half crate
2019-08-23 14:03:39 +02:00
Trevor Spiteri
348463d204
state aims at top of documentation
2019-08-23 10:03:59 +02:00
Trevor Spiteri
e24a0963f6
add Frac type to Fixed trait
2019-08-22 19:30:52 +02:00
Trevor Spiteri
3292a2da26
some minor doc improvements
2019-08-22 14:26:08 +02:00
Trevor Spiteri
87d30cd8b1
reorder some methods
2019-08-22 14:03:32 +02:00
Trevor Spiteri
9e333d99c2
add round_to_zero
2019-08-22 13:39:51 +02:00
Trevor Spiteri
7d08654e0a
cleaner rounding examples
2019-08-22 13:04:39 +02:00
Trevor Spiteri
0eade78071
add round_ties_to_even and checked variants
2019-08-22 13:01:28 +02:00
Trevor Spiteri
b3796a46f0
make is_power_of_two a const fn
2019-08-21 22:15:36 +02:00
Trevor Spiteri
696361a8fa
macro formatting
2019-08-21 16:57:52 +02:00
Trevor Spiteri
381af22e96
make {,wrapping_,overflowing_}abs const
2019-08-21 15:46:24 +02:00
Trevor Spiteri
895d59611d
fix and expand rounding test
2019-08-21 15:45:55 +02:00
Trevor Spiteri
ba594f24e1
document bug fix in release notes
2019-08-21 13:30:49 +02:00
Trevor Spiteri
08fc9881e5
make display code clearer
2019-08-21 13:02:43 +02:00
Trevor Spiteri
8176a36a95
version 0.4.3
2019-08-20 19:40:53 +02:00
Trevor Spiteri
f423fe0159
impl {Shl,Shr}{,Assign}<all primitives> for Wrapping
2019-08-20 17:07:13 +02:00
Trevor Spiteri
fa271a4a9d
doc updates
2019-08-20 16:42:37 +02:00
Trevor Spiteri
46049bb7ac
tweak consts example
2019-08-20 15:31:39 +02:00
Trevor Spiteri
0b4dac8d33
reorganize modules
2019-08-20 15:30:23 +02:00
Trevor Spiteri
96107159f5
some cleanups in tests inside display.rs
2019-08-20 01:18:22 +02:00
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
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
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
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
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
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
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
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
Trevor Spiteri
419e291507
version 0.3.3
2019-06-27 23:54:28 +02:00
Trevor Spiteri
8a13d678b6
document conversions to/from {isize,usize}
2019-06-27 23:31:34 +02:00
Trevor Spiteri
e3672475cf
test conversions to isize/usize
2019-06-27 23:28:35 +02:00
Trevor Spiteri
66235d74e7
impl Int for isize and usize
2019-06-27 23:08:57 +02:00
Trevor Spiteri
06e7d0d8f9
clippy
2019-05-28 15:12:25 +02:00
Trevor Spiteri
fce0beaeb5
typos
2019-02-28 14:55:57 +01:00
Trevor Spiteri
ded37197a6
version 0.3.2
2019-02-27 22:52:15 +01:00
Trevor Spiteri
ef5ff4bc99
add Wrapping
2019-02-27 22:23:50 +01:00
Trevor Spiteri
955dfaa618
reword debug mode -> when debug assertions are enabled
2019-02-21 19:07:54 +01:00
Trevor Spiteri
c0a8952f41
add examples to overflowing arithmetic operations
2019-02-08 00:30:28 +01:00
Trevor Spiteri
6ee7971959
add examples to wrapping arithmetic operations
2019-02-07 23:57:48 +01:00
Trevor Spiteri
101f5c6d5c
add examples to saturating arithmetic operations
2019-02-07 23:07:37 +01:00
Trevor Spiteri
0352ba65a6
add examples to checked arithmetic operations
2019-02-07 22:53:33 +01:00
Trevor Spiteri
bdf6f9fe88
doc tweaks
2019-02-07 22:01:37 +01:00
Trevor Spiteri
7d99bf3fbf
typo
2019-02-07 21:56:10 +01:00
Trevor Spiteri
b083666255
update struct Fixed example
2019-02-07 14:48:13 +01:00
Trevor Spiteri
e091e76d52
version 0.3.1
2019-02-07 00:59:41 +01:00
Trevor Spiteri
5f825f6833
doc typo
2019-02-06 13:49:19 +01:00
Trevor Spiteri
fc9b952a33
inline some functions
2019-02-06 13:49:11 +01:00
Trevor Spiteri
9be60f6b91
split some macro parts from lib.rs
2019-02-05 19:09:58 +01:00
Trevor Spiteri
01af26827d
clean up some doc macros
2019-02-04 17:29:40 +01:00
Trevor Spiteri
af9cda1078
reimplement From<bool> for fixed-point numbers
2019-02-04 12:46:42 +01:00
Trevor Spiteri
004077a002
version 0.3.0
2019-02-03 21:37:17 +01:00
Trevor Spiteri
27f8f57f90
deprecate/rename {int,frac}_bits -> {int,frac}_nbits
2019-02-03 20:36:08 +01:00
Trevor Spiteri
27c9ee7b0f
implement comparisons between fixed and float
2019-02-03 20:25:37 +01:00
Trevor Spiteri
8c0117877b
s/prim/int/ in convert.rs
2019-02-03 19:17:19 +01:00
Trevor Spiteri
c997c4ffeb
remove bool from Int trait
2019-02-02 23:53:03 +01:00
Trevor Spiteri
78cb0ea9b6
generalize comparisons between fixeds and ints
2019-02-02 23:45:03 +01:00
Trevor Spiteri
50f0368c87
fix saturating_from_fixed
2019-02-02 22:28:11 +01:00
Trevor Spiteri
8209c4466d
optimization: do not mix sar and shr in fixed conversion
2019-02-02 21:33:01 +01:00
Trevor Spiteri
8bfc52c3ab
remove repr(transparent) check from build.rs
2019-02-02 20:20:53 +01:00
Trevor Spiteri
b20969dc6d
work around https://github.com/rust-lang/rust/issues/58067
2019-02-02 02:32:10 +01:00
Trevor Spiteri
0787f10480
to_fixed_neg_abs_overflow -> to_fixed_dir_overflow
2019-02-02 01:57:14 +01:00
Trevor Spiteri
9ebfa67cac
to_fixed_overflow -> to_fixed_dir_overflow
2019-02-01 23:38:58 +01:00
Trevor Spiteri
7e9e3ef04d
{saturating,wrapping,overflowing}_to_{fixed,int}
2019-02-01 20:46:51 +01:00
Trevor Spiteri
3b3d22fc6f
remove checked_to_float
2019-02-01 14:53:25 +01:00
Trevor Spiteri
ed3ed75093
add from_fixed to trait Float
2019-02-01 14:53:14 +01:00
Trevor Spiteri
9c22e037c0
add from_fixed plus checked versions to trait Int
2019-02-01 14:45:17 +01:00
Trevor Spiteri
f7300c7f8a
add to_fixed plus checked versions to traits Int and Float
2019-02-01 02:40:35 +01:00
Trevor Spiteri
c9e9686ac4
consistent {to,checked_to}_{fixed,int,float}, some doc updates
2019-02-01 01:13:53 +01:00
Trevor Spiteri
91a4173669
remove unneeded functions
2019-01-31 02:57:55 +01:00
Trevor Spiteri
5d543fef64
fix SealedInt::is_negative
2019-01-31 02:06:22 +01:00
Trevor Spiteri
f7d2fc18e0
code cleanups
2019-01-31 01:58:59 +01:00
Trevor Spiteri
aa707df6c9
constify some stuff
2019-01-30 17:31:24 +01:00
Trevor Spiteri
87b00f66a2
add to_fixed
2019-01-29 23:20:38 +01:00
Trevor Spiteri
f9dc12203e
remove useless code
2019-01-29 23:19:42 +01:00
Trevor Spiteri
d5e135889c
version 0.2.1
2019-01-29 23:16:09 +01:00
Trevor Spiteri
f1f75e4c67
clippy
2019-01-29 22:01:12 +01:00
Trevor Spiteri
009142f2af
add anther example to main doc
2019-01-29 21:55:58 +01:00
Trevor Spiteri
455a770f03
fix display precision bug
2019-01-29 21:47:55 +01:00
Trevor Spiteri
11f6c2bb93
move deprecated functions to bottom
2019-01-29 20:15:10 +01:00
Trevor Spiteri
bb7d16d4cb
clean up some more doc macros
2019-01-29 20:11:00 +01:00
Trevor Spiteri
e3d4be53ce
fix conversions from negative to fixed
2019-01-29 18:31:07 +01:00
Trevor Spiteri
d3c09db948
clean up some doc macros
2019-01-29 16:49:20 +01:00
Trevor Spiteri
1725b12340
version 0.2.0
2019-01-29 03:35:42 +01:00
Trevor Spiteri
779df07f89
clean up some docs
2019-01-29 03:28:23 +01:00
Trevor Spiteri
3fbd016ac6
fix to_int and deprecate to_int_{ceil,floor,round}
...
to_int was not truncating fractional bits for negative numbers with
non-zero fractions, but was rounding towards zero instead.
2019-01-29 03:04:02 +01:00
Trevor Spiteri
fc7d971cf2
add checked and unchecked rounding functions
2019-01-29 02:09:23 +01:00
Trevor Spiteri
63e1031e24
add saturating rounding functions
2019-01-29 01:38:05 +01:00
Trevor Spiteri
0eb2e1f48e
add wrapping rounding functions
2019-01-29 01:27:38 +01:00
Trevor Spiteri
5e5c24c0e9
add overflowing rounding functions
2019-01-29 01:12:48 +01:00
Trevor Spiteri
2a8b7b450c
implement checked conversions from int and fixed
2019-01-28 22:34:42 +01:00
Trevor Spiteri
d6775959c2
add methods to SealedInt and SealedFixed for from_int and from_fixed
2019-01-28 20:44:56 +01:00
Trevor Spiteri
073ffb0f29
fix comment typo
2019-01-28 20:15:30 +01:00
Trevor Spiteri
53969028ff
remove unused from_parts
2019-01-28 20:02:22 +01:00
Trevor Spiteri
e8af3cf2e7
doc tweaks
2019-01-28 19:59:27 +01:00
Trevor Spiteri
2a7cf2c4b5
complete from_float family of functions
...
Now from_float, checked_from_float, saturating_from_float,
wrapping_from_float and overflowing_from_float are all implemented.
2019-01-28 19:45:33 +01:00
Trevor Spiteri
cb10ff5ca0
replace from_int -> checked_from_int
2019-01-28 04:31:51 +01:00
Trevor Spiteri
3724d461b6
document that signum can panic if the signum cannot be represented
2019-01-28 04:30:56 +01:00
Trevor Spiteri
3b9c5684ff
doc fixes
2019-01-28 04:04:19 +01:00
Trevor Spiteri
b3f2d2d120
replace {to,from}_{f16,f32,f64} -> {to,from}_float
2019-01-28 03:41:44 +01:00
Trevor Spiteri
5e08e91280
refactoring: add sealed traits for int, float, fixed
2019-01-28 00:25:05 +01:00
Trevor Spiteri
351ede5ba7
version 0.1.6: fmt
2019-01-27 00:46:12 +01:00
Trevor Spiteri
2a2395af10
version 0.1.6: serde support
2019-01-27 00:39:24 +01:00
Trevor Spiteri
26dbf7059c
version 0.1.5: mention types module in release notes
2019-01-26 22:22:18 +01:00
Trevor Spiteri
9b8e36a71d
version 0.1.5
2019-01-26 22:02:58 +01:00
Trevor Spiteri
3d6bfecf6f
fix f16 build
2019-01-26 21:49:13 +01:00
Trevor Spiteri
59b407ba61
add bool to fixed conversion
2019-01-26 21:44:34 +01:00
Trevor Spiteri
ef902eb60e
move float conversions to convert.rs
2019-01-26 21:32:06 +01:00
Trevor Spiteri
b71b41cd70
implement infallible fixed to primitive conversions
2019-01-26 21:16:20 +01:00
Trevor Spiteri
266f2910ce
add infallible conversions from other Fixed and from primitives
2019-01-26 20:38:25 +01:00
Trevor Spiteri
9969f2f243
add feature to fail on warnings
2019-01-26 03:59:00 +01:00
Trevor Spiteri
56b3176deb
clippy
2019-01-26 03:52:41 +01:00
Trevor Spiteri
ac245367dd
add types module
2018-11-29 10:40:36 +01:00
Trevor Spiteri
c69544b9a0
version 0.1.4
2018-11-29 09:55:39 +01:00
Trevor Spiteri
02dded4476
prepend clippy lint names with clippy::
2018-11-29 09:49:18 +01:00
Trevor Spiteri
0642db9baa
fmt
2018-11-29 09:35:35 +01:00
Trevor Spiteri
e4a1afe07e
support for u128 and i128 division
2018-11-02 21:20:17 +01:00