changes
All checks were successful
CI / ci (push) Successful in 19m38s

This commit is contained in:
2026-08-26 20:55:30 +02:00
parent a557c183e9
commit 23d052278a
523 changed files with 24448 additions and 2005 deletions

View File

@@ -0,0 +1,29 @@
use crate::errors::DomainError;
use super::normal::two_sided_tail;
const CERTAIN: f64 = 1.0;
const IMPOSSIBLE: f64 = 0.0;
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub struct PValue(f64);
impl PValue {
pub fn new(value: f64) -> Result<Self, DomainError> {
if !value.is_finite() || !(IMPOSSIBLE..=CERTAIN).contains(&value) {
return Err(DomainError::InvalidInput(format!(
"a p-value must be between {IMPOSSIBLE} and {CERTAIN}, got {value}"
)));
}
Ok(Self(value))
}
pub fn from_standard_score(standard_score: f64) -> Self {
Self(two_sided_tail(standard_score))
}
pub fn value(&self) -> f64 {
self.0
}
}