pikopiko-runtime 0.1.0

no_std, heap-free runtime for pikopiko: synth trait, event-binary sequencer, effects and built-in synths (AY-3-8912, buzzer, sfx).
Documentation
//! 浮動小数点の三角関数・指数関数(`libm` の pure Rust 実装)。
//!
//! 標準ライブラリの `f32::sin` などは OS や CPU の数学ライブラリを呼ぶことがあり、
//! 機種によって最後の桁が変わりうる。同じ MML から機種をまたいで同じ音(同じサンプル列)を
//! 出すため、`va`・`sfx-hd` の音作りではここの関数だけを使う。
//! 四則演算・`sqrt`・`floor`・`%`(`fmod`)などは IEEE 754 で結果がちょうど決まっているので、
//! そのまま使ってよい。

#[inline]
pub fn sin(x: f32) -> f32 {
    libm::sinf(x)
}

#[inline]
pub fn cos(x: f32) -> f32 {
    libm::cosf(x)
}

#[inline]
pub fn tan(x: f32) -> f32 {
    libm::tanf(x)
}

#[inline]
pub fn exp(x: f32) -> f32 {
    libm::expf(x)
}

#[inline]
pub fn exp2(x: f32) -> f32 {
    libm::exp2f(x)
}

#[inline]
pub fn ln(x: f32) -> f32 {
    libm::logf(x)
}

#[inline]
pub fn log10(x: f32) -> f32 {
    libm::log10f(x)
}

#[inline]
pub fn tanh(x: f32) -> f32 {
    libm::tanhf(x)
}

#[inline]
pub fn powf(x: f32, y: f32) -> f32 {
    libm::powf(x, y)
}