#fixed-point #dsp #numerical #trigonometric #approximation #trigonometry #numbers

no-std fixed_trigonometry

Fixed point numerical approimations to trigonometric functions

22 releases

0.4.4 Sep 30, 2024
0.4.3 May 8, 2022
0.4.2 Mar 20, 2022
0.3.1 Nov 29, 2021

#410 in Math

Download history 6/week @ 2024-09-23 173/week @ 2024-09-30 9/week @ 2024-10-07 9/week @ 2024-10-14

191 downloads per month

Custom license

35KB
489 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