pub fn validate_range(
value: f64,
min: f64,
max: f64,
parameter: &'static str,
) -> Result<()>Expand description
Validate that a value is within a range.
§Arguments
value- The value to checkmin- Minimum valid value (inclusive)max- Maximum valid value (inclusive)parameter- Name of the parameter for error messages
§Errors
Returns AstroError::OutOfRange if the value is outside [min, max].
§Example
use astro_math::error::validate_range;
assert!(validate_range(45.0, 0.0, 90.0, "altitude").is_ok());
assert!(validate_range(100.0, 0.0, 90.0, "altitude").is_err());