#base #logarithm #fixed-point #10 #algorithm #logefix #log10fix

log2fix

no_std fixed-point base 2, e and 10 logarithm algorithm implementation

1 unstable release

0.1.0 Jun 23, 2021

#1417 in Math

MIT license

9KB
161 lines

API:

pub fn log2fix(x: u32, precision: usize) -> i32
pub fn logefix(x: u32, precision: usize) -> i32
pub fn log10fix(x: u32, precision: usize) -> i32

You can play around with a cli example:

cargo run --example cli

Based on https://github.com/dmoulding/log2fix C implementation.

No runtime deps