agentbible 0.1.0

Language-agnostic correctness checker for scientific numerical code
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::AgentBibleError;

#[derive(Debug, Clone, Copy, PartialEq)]
pub struct FiniteFloat(f64);

impl FiniteFloat {
    pub fn new(v: f64) -> Result<Self, AgentBibleError> {
        if v.is_finite() {
            Ok(Self(v))
        } else {
            Err(AgentBibleError::NonFinite)
        }
    }

    pub fn value(&self) -> f64 {
        self.0
    }
}