pub(crate) const RS_FACTOR: f64 = 0.620_350_490_899_400_1;
pub(crate) const X_FACTOR_C: f64 = 0.930_525_736_349_1;
pub(crate) const LDA_X_FACTOR: f64 = -X_FACTOR_C;
pub(crate) const TWO_POW_M4_3: f64 = 0.396_850_262_992_049_84;
pub(crate) const FZETA_DENOM: f64 = 0.519_842_099_789_746_4;
pub(crate) const FPP_VWN: f64 = 1.709_920_934_161_365_3;
pub(crate) const X2S: f64 = 0.128_278_243_853_042_2;
pub(crate) const FOUR_CBRT2: f64 = 5.039_684_199_579_493;
#[cfg(test)]
mod tests {
use super::*;
use std::f64::consts::PI;
fn close(a: f64, b: f64) -> bool {
(a - b).abs() <= 1e-15 * b.abs().max(1.0)
}
#[test]
fn constants_match_exact() {
assert!(close(RS_FACTOR, (3.0 / (4.0 * PI)).cbrt()), "RS_FACTOR");
let xfc = 3.0 / 8.0 * (3.0 / PI).powf(1.0 / 3.0) * 4.0_f64.powf(2.0 / 3.0);
assert!(close(X_FACTOR_C, xfc), "X_FACTOR_C {X_FACTOR_C} vs {xfc}");
assert!(
close(TWO_POW_M4_3, 2.0_f64.powf(-4.0 / 3.0)),
"TWO_POW_M4_3"
);
assert!(
close(FZETA_DENOM, 2.0_f64.powf(4.0 / 3.0) - 2.0),
"FZETA_DENOM"
);
assert!(
close(FPP_VWN, 4.0 / (9.0 * (2.0_f64.cbrt() - 1.0))),
"FPP_VWN"
);
assert!(
close(X2S, 1.0 / (2.0 * (6.0 * PI * PI).cbrt())),
"X2S {X2S} vs {}",
1.0 / (2.0 * (6.0 * PI * PI).cbrt())
);
assert!(
close(FOUR_CBRT2, 4.0 * 2.0_f64.cbrt()),
"FOUR_CBRT2 {FOUR_CBRT2} vs {}",
4.0 * 2.0_f64.cbrt()
);
}
}