mathhook_core/core/
constants.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7pub enum MathConstant {
8 Pi,
9 E,
10 I,
11 Infinity,
12 NegativeInfinity,
13 Undefined,
14 GoldenRatio,
15 EulerGamma,
16 TribonacciConstant,
17}
18
19impl MathConstant {
20 pub fn to_f64(self) -> f64 {
31 match self {
32 MathConstant::Pi => std::f64::consts::PI,
33 MathConstant::E => std::f64::consts::E,
34 MathConstant::I => f64::NAN,
35 MathConstant::Infinity => f64::INFINITY,
36 MathConstant::NegativeInfinity => f64::NEG_INFINITY,
37 MathConstant::Undefined => f64::NAN,
38 MathConstant::GoldenRatio => 1.618033988749895,
39 MathConstant::EulerGamma => 0.5772156649015329,
40 MathConstant::TribonacciConstant => 1.839286755214161,
41 }
42 }
43}
44
45pub const EPSILON: f64 = 1e-10;