6 releases
0.2.2 | Sep 7, 2023 |
---|---|
0.2.1 | Dec 17, 2022 |
0.2.0 | Oct 5, 2022 |
0.1.2 | Sep 27, 2022 |
0.1.1 | Mar 9, 2022 |
#779 in Encoding
Used in 3 crates
(via acolor)
24KB
345 lines
iunorm
This library facilitates mapping between floating-point numbers, normalized to some range, and (un)signed integers.
Inorm
types are a new-type over signed integers that by default map to floating-point range of-1..1
.Unorm
types are a new-type over unsigned integers that by default map to floating-point range of0..1
.
The by default mapping is used by the From
/Into
traits and the
from_f32
/to_f32
methods, and the equivalent f64
versions.
Additionally both Inorm
& Unorm
types can map from/to any custom
floating-point range by using the from_f32_minmax
/to_f32_minmax
methods,
and the equivalent f64
versions.
Status
This library is considered stable.
License
This project is dual licensed under either MIT or Apache-2.0 at your option.