Skip to content

Add Probability (primitives) #72

@vhrcgcom

Description

@vhrcgcom

Description

Implement Probability as a ValueObject in the primitives module.

Spec: f64 in range 0.0..=1.0

Implementation checklist

  • Create src/primitives/probability.rs
  • Implement ValueObject trait
  • Add #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
  • Export from src/primitives/mod.rs and prelude
  • Unit tests: valid input · empty input · invalid format · normalisation
  • Doc comment with # Example block
  • Update status in ROADMAP.md from ⬜ to ✅

Implementation detail

Input / Output

Type Alias
Input f64 ProbabilityInput
Output f64 ProbabilityOutput

Normalization

None.

Validation

  • Must be finite (not NaN, not infinite).
  • Must be in the range 0.0..=1.0 (inclusive on both ends).

Extra methods

None beyond the trait.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions