Midpoint two-place function

Two-place midpoint function is the function returning an average of two values, such as values of signed or unsigned integer types, floating point types, or pointer types.

This library provides several implementations of two-place midpoint function [currently, only for primitive integers] with different properties (performance, generality, and rounding behavior) whereas the GitHub repo of the lib offers the design document, tests, runnable benchmarks, and pre-generated criterion.rs performance reports.

Example

Cargo.toml

toml [dependencies] midpoint = { version = "0.1.0", features = ["all"] }

src/main.rs

```rust use midpoint::MidpointViaPrimitivePromotionExt;

let result: i32 = (-7).midpointviaprimitivepromotion(&-2); asserteq!(result, -4); ```

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.