Skip to content

Instantly share code, notes, and snippets.

@sug0
sug0 / sin.rs
Last active February 16, 2022 09:57
Constant function sin table in Rust
#![feature(const_fn)]
#![feature(const_raw_ptr_deref)]
fn main() {
const SIN_90: f32 = SINTAB[90];
println!("{}", SIN_90);
}
const fn to_radians(x: f64) -> f64 {
x * (std::f64::consts::PI / 180.0)