use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
pub enum MathConstant {
Pi,
E,
I,
Infinity,
NegativeInfinity,
Undefined,
GoldenRatio,
EulerGamma,
TribonacciConstant,
}
impl MathConstant {
pub fn to_f64(self) -> f64 {
match self {
MathConstant::Pi => std::f64::consts::PI,
MathConstant::E => std::f64::consts::E,
MathConstant::I => f64::NAN,
MathConstant::Infinity => f64::INFINITY,
MathConstant::NegativeInfinity => f64::NEG_INFINITY,
MathConstant::Undefined => f64::NAN,
MathConstant::GoldenRatio => 1.618033988749895,
MathConstant::EulerGamma => 0.5772156649015329,
MathConstant::TribonacciConstant => 1.839286755214161,
}
}
}
pub const EPSILON: f64 = 1e-10;