Crates.io | iunorm |
lib.rs | iunorm |
version | 0.2.2 |
source | src |
created_at | 2022-03-08 23:36:38.177776 |
updated_at | 2023-09-07 16:41:53.994625 |
description | Map normalized floating-point numbers to/from (un)signed integers |
homepage | |
repository | https://github.com/joseluis/iunorm |
max_upload_size | |
id | 546634 |
size | 26,099 |
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 of 0..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.
This library is considered stable.
This project is dual licensed under either MIT or Apache-2.0 at your option.