#fixed-point #fixed-number #trigonometry #dsp #no-std #fixed-i32 #trigonometric

no-std fixed_trigonometry

Fixed point numerical approimations to trigonometric functions

21 unstable releases (3 breaking)

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

#1113 in Math

45 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

~3.5MB
~65K SLoC