#dsp #no-std

no-std fixed_trigonometry

Fixed point numerical approimations to trigonometric functions

21 unstable releases (3 breaking)

Uses new Rust 2021

0.4.3 May 8, 2022
0.4.2 Mar 20, 2022
0.3.6 Feb 1, 2022
0.3.5 Jan 30, 2022
0.1.2 Sep 18, 2021

#660 in Rust patterns

Download history 4/week @ 2022-08-12 4/week @ 2022-08-19 22/week @ 2022-08-26 4/week @ 2022-09-02 71/week @ 2022-09-09 3/week @ 2022-09-16 2/week @ 2022-09-23 17/week @ 2022-09-30 18/week @ 2022-10-07 5/week @ 2022-10-14 3/week @ 2022-10-21 8/week @ 2022-10-28 27/week @ 2022-11-04 6/week @ 2022-11-11 16/week @ 2022-11-18 2/week @ 2022-11-25

52 downloads per month

Custom license

34KB
492 lines

Fixed Trigonometry

No-STD fixed-point implementation of trigonometric functions in Rust.

It utilizes the fixed library to allow flexibility in fixed point sizes and precisions.

The package.

The documentation.

Release notes are found under RELEASES.md.

Functionality

The library currently implements:

  • fft/ifft calculation, for complex fixed-point vectors.
  • sin and cos using low order polynomails, for real fixed-point numbers.
  • atan using numerical methods.
  • sqrt using the Nonlinear IIR Filter (NIIRF) method.
  • powi and complex::powi calculation.
  • no-std utilities for complex numbers.

lib.rs:

No-STD fixed-point numeric implementation of trigonometric functions in Rust.

It utilizes the fixed library to allow flexibility in fixed point sizes and precisions.

The library mixed-num has these functions implemented as traits.

The library NDSP support fixed point numbers in vectors, with various implemented operations.

Example

use fixed_trigonometry::*;
use fixed::{types::extra::U28, FixedI32};

let arg = atan::atan( FixedI32::<U28>::from_num(0.6)/FixedI32::<U28>::from_num(0.4) );
assert_eq!{ arg.to_num::<f32>(), 0.9782037 };

Dependencies

~3MB
~62K SLoC