version 0.3.0

This commit is contained in:
Trevor Spiteri 2019-02-03 21:37:17 +01:00
parent 27f8f57f90
commit 004077a002
4 changed files with 40 additions and 86 deletions

View File

@ -7,7 +7,7 @@
[package]
name = "fixed"
version = "0.2.1"
version = "0.3.0"
authors = ["Trevor Spiteri <tspiteri@ieee.org>"]
description = "Fixed-point numbers"
documentation = "https://docs.rs/fixed"

114
README.md
View File

@ -39,17 +39,23 @@ numeric primitives are implemented. That is, you can use [`From`] or
## Whats new
### Version 0.3.0 news (unreleased)
### Version 0.3.0 news (2019-02-03)
* <mark>Every fixed-point type now supports coversion to/from all
#### Highlights
* Every fixed-point type now supports coversion to/from all
primitive number types, including checked versions of the
conversions.</mark>
* <mark>Every fixed-point type now supports comparisons with all
primitive number types.</mark>
* Incompatible change: the method [`to_int`] was changed; now its
return type is generic.
* Incompatible change: The [`Int`] trait implementation for [`bool`]
was removed.
conversions.
* Every fixed-point type now supports comparisons with all primitive
number types.
#### Incompatible changes
* The method [`to_int`] was changed; now its return type is generic.
* The [`Int`] trait implementation for [`bool`] was removed.
#### Other changes
* The new method [`to_fixed`] was added.
* Checked versions of [`to_fixed`] and [`to_int`] were added.
* The methods [`from_fixed`][`Int::from_fixed`] and
@ -75,62 +81,6 @@ numeric primitives are implemented. That is, you can use [`From`] or
[`to_fixed`]: https://docs.rs/fixed/0.3.0/fixed/struct.FixedI32.html#method.to_fixed
[`to_int`]: https://docs.rs/fixed/0.3.0/fixed/struct.FixedI32.html#method.to_int
### Version 0.2.1 news (2019-01-29)
* Bug fix: the [`from_fixed`] and [`from_int`] methods (and their
checked counterparts) could return wrong values for negative
values.
* Bug fix: display was using one fractional digit less than
required, thus yielding the same output for diffent fixed-point
numbers.
### Version 0.2.0 news (2019-01-29)
* Incompatible change: the method [`from_int`] was changed to accept
a generic prameter.
* The new methods [`from_fixed`] and [`from_float`] were added.
* Checked versions of [`from_fixed`], [`from_int`] and
[`from_float`] were added.
* The new method [`to_float`] was added.
* The [`to_int`] method was changed to truncate fractional bits as
documented for negative values.
* The new methods [`ceil`], [`floor`] and [`round`], and their
checked versions, were added.
* The methods [`to_int_ceil`], [`to_int_floor`] and [`to_int_round`]
were deprecated.
[`ceil`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.ceil
[`floor`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.floor
[`from_f16`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.from_f16
[`from_f32`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.from_f32
[`from_f64`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.from_f64
[`from_fixed`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.from_fixed
[`from_float`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.from_float
[`from_int`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.from_int
[`from_int`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.from_int
[`round`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.round
[`to_f16`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.to_f16
[`to_f32`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.to_f32
[`to_f64`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.to_f64
[`to_float`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.to_float
[`to_int_ceil`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.to_int_ceil
[`to_int_floor`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.to_int_floor
[`to_int_round`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.to_int_round
[`to_int`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html#method.to_int
### Version 0.1.6 news (2019-01-27)
* Optional [serde][*serde* crate] support was added.
### Version 0.1.5 news (2019-01-26)
* A new module [`types`] is available with aliases for all supported
fixed-point numbers.
* Lossless infallible conversions between fixed-point numbers and
numeric primitives are now supported using [`From`] and [`Into`].
[`types`]: https://docs.rs/fixed/0.2.1/fixed/types/index.html
### Other releases
Details on other releases can be found in [*RELEASES.md*].
@ -149,6 +99,8 @@ let six_and_third = I20F12::from_int(19) / 3;
assert_eq!(six_and_third.to_string(), "6.3333");
// find the ceil and convert to i32
assert_eq!(six_and_third.ceil().to_int::<i32>(), 7);
// we can also compare directly to integers
assert_eq!(six_and_third.ceil(), 7);
```
The type [`I20F12`] is a 32-bit fixed-point signed number with 20
@ -197,7 +149,7 @@ it in your crate, add it as a dependency inside [*Cargo.toml*]:
```toml
[dependencies]
fixed = "0.2.1"
fixed = "0.3.0"
```
If you are using the 2015 Rust edition, you also need to declare it by
@ -224,7 +176,7 @@ To enable features, you can add the dependency like this to
```toml
[dependencies.fixed]
version = "0.2.1"
version = "0.3.0"
features = ["f16", "serde"]
```
@ -252,22 +204,22 @@ additional terms or conditions.
[*typenum* crate]: https://crates.io/crates/typenum
[LICENSE-APACHE]: https://www.apache.org/licenses/LICENSE-2.0
[LICENSE-MIT]: https://opensource.org/licenses/MIT
[`FixedI128`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI128.html
[`FixedI16`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI16.html
[`FixedI32`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI32.html
[`FixedI64`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI64.html
[`FixedI8`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedI8.html
[`FixedU128`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedU128.html
[`FixedU16`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedU16.html
[`FixedU32`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedU32.html
[`FixedU64`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedU64.html
[`FixedU8`]: https://docs.rs/fixed/0.2.1/fixed/struct.FixedU8.html
[`FixedI128`]: https://docs.rs/fixed/0.3.0/fixed/struct.FixedI128.html
[`FixedI16`]: https://docs.rs/fixed/0.3.0/fixed/struct.FixedI16.html
[`FixedI32`]: https://docs.rs/fixed/0.3.0/fixed/struct.FixedI32.html
[`FixedI64`]: https://docs.rs/fixed/0.3.0/fixed/struct.FixedI64.html
[`FixedI8`]: https://docs.rs/fixed/0.3.0/fixed/struct.FixedI8.html
[`FixedU128`]: https://docs.rs/fixed/0.3.0/fixed/struct.FixedU128.html
[`FixedU16`]: https://docs.rs/fixed/0.3.0/fixed/struct.FixedU16.html
[`FixedU32`]: https://docs.rs/fixed/0.3.0/fixed/struct.FixedU32.html
[`FixedU64`]: https://docs.rs/fixed/0.3.0/fixed/struct.FixedU64.html
[`FixedU8`]: https://docs.rs/fixed/0.3.0/fixed/struct.FixedU8.html
[`From`]: https://doc.rust-lang.org/nightly/std/convert/trait.From.html
[`I20F12`]: https://docs.rs/fixed/0.2.1/fixed/types/type.I20F12.html
[`I4F12`]: https://docs.rs/fixed/0.2.1/fixed/types/type.I4F12.html
[`I4F4`]: https://docs.rs/fixed/0.2.1/fixed/types/type.I4F4.html
[`I20F12`]: https://docs.rs/fixed/0.3.0/fixed/types/type.I20F12.html
[`I4F12`]: https://docs.rs/fixed/0.3.0/fixed/types/type.I4F12.html
[`I4F4`]: https://docs.rs/fixed/0.3.0/fixed/types/type.I4F4.html
[`Into`]: https://doc.rust-lang.org/nightly/std/convert/trait.Into.html
[`U20F12`]: https://docs.rs/fixed/0.2.1/fixed/types/type.U20F12.html
[`U20F12`]: https://docs.rs/fixed/0.3.0/fixed/types/type.U20F12.html
[`f16`]: https://docs.rs/half/^1/half/struct.f16.html
[`from_fixed`]: struct.FixedI8.html#method.from_fixed
[const generics]: https://github.com/rust-lang/rust/issues/44580

View File

@ -5,7 +5,7 @@ modification, are permitted in any medium without royalty provided the
copyright notice and this notice are preserved. This file is offered
as-is, without any warranty. -->
Version 0.3.0 (unreleased)
Version 0.3.0 (2019-02-03)
==========================
* Incompatible change: the return type of `to_int` is now generic.

View File

@ -58,6 +58,8 @@ let six_and_third = I20F12::from_int(19) / 3;
assert_eq!(six_and_third.to_string(), "6.3333");
// find the ceil and convert to i32
assert_eq!(six_and_third.ceil().to_int::<i32>(), 7);
// we can also compare directly to integers
assert_eq!(six_and_third.ceil(), 7);
```
The type [`I20F12`] is a 32-bit fixed-point signed number with 20
@ -106,7 +108,7 @@ it in your crate, add it as a dependency inside [*Cargo.toml*]:
```toml
[dependencies]
fixed = "0.2.1"
fixed = "0.3.0"
```
If you are using the 2015 Rust edition, you also need to declare it by
@ -133,7 +135,7 @@ To enable features, you can add the dependency like this to
```toml
[dependencies.fixed]
version = "0.2.1"
version = "0.3.0"
features = ["f16", "serde"]
```
@ -183,7 +185,7 @@ additional terms or conditions.
*/
#![no_std]
#![warn(missing_docs)]
#![doc(html_root_url = "https://docs.rs/fixed/0.2.1")]
#![doc(html_root_url = "https://docs.rs/fixed/0.3.0")]
#![doc(test(attr(deny(warnings))))]
#![cfg_attr(feature = "fail-on-warnings", deny(warnings))]