Crates.io | ape-table-trig |
lib.rs | ape-table-trig |
version | 0.2.0 |
source | src |
created_at | 2023-05-09 03:01:25.376866 |
updated_at | 2023-05-09 19:21:33.704 |
description | implementations of sin, cos, and tan using precalculated tables |
homepage | |
repository | https://github.com/Gip-Gip/ape-table-trig |
max_upload_size | |
id | 860213 |
size | 13,607 |
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.
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);
}