#trigonometry #math #no-std #floating-point

no-std ape-table-trig

implementations of sin, cos, and tan using precalculated tables

2 unstable releases

0.2.0 May 9, 2023
0.1.0 May 9, 2023

#865 in Embedded development

MIT license

12KB
160 lines

Ape Table Trigonometry

Implementations of sin, cos, and tan using precalculated tables.

Using these functions can significantly improve performance on systems with limited to no naitive floating point support, like the RP2040. Designed to be no_std compatible out of the box.

Example:

use ape_table_trig::*;

// Table has an accuracy down to 1πmrad
static TABLE: [f32; 1000] = trig_table_gen_f32!(1000);

fn main() {
    let table = TrigTableF32::new(&TABLE);

    // Calculate the sine of 1π radians
    let sine = table.sin(PI_F32);
}

lib.rs:

Implementations of sin, cos, and tan using precalculated tables.

Using these functions can significantly improve performance on systems with limited to no naitive floating point support, like the RP2040. Designed to be no_std compatible out of the box.

Example:

use ape_table_trig::*;

// Table has an accuracy down to 1πmrad
static TABLE: [f32; 1000] = trig_table_gen_f32!(1000);

fn main() {
    let table = TrigTableF32::new(&TABLE);

    // Calculate the sine of 1π radians
    let sine = table.sin(PI_F32);
}

Dependencies