Expand description
§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);
}
Macros§
- trig_
table_ gen_ f32 - Generate a trig table of F32s. Provide the size of the table in usize.
- trig_
table_ gen_ f64 - Generate a trig table of F64s. Provide the size of the table in usize.
Structs§
- Trig
Table F32 - Used to perform sin, cos, and tan functions on trig tables. F32.
- Trig
Table F64 - Used to perform sin, cos, and tan functions on trig tables. F64.
Constants§
- FULL_
CIRC_ F32 - Full circumference in radians, equal to 2π. F32.
- FULL_
CIRC_ F64 - Full circumference in radians, equal to 2π. F32.
- GEN_
LIMIT_ F32 - Generation limit for the trig table. Currently the table generation generates sin(0)..sin(1π), and then uses some math to finesse the table to work for all other values. F32.
- GEN_
LIMIT_ F64 - Generation limit for the trig table. F64
- HALF_
CIRC_ F32 - Half circumference in radians, equal to 1π. F32.
- HALF_
CIRC_ F64 - Half circumference in radians, equal to 1π. F64.
- PI_F32
- Archimedes’ constant (π)
- PI_F64
- Archimedes’ constant (π)
- QUART_
CIRC_ F32 - Quarter circumference in radians, equal to ½π. F32.
- QUART_
CIRC_ F64 - Quarter circumference in radians, equal to ½π. F64.