Algorithms must explicitly define and consistently handle special values like NaN, infinity, and edge cases across all mathematical operations. Special values can significantly impact computational results and should not be treated as afterthoughts.
Algorithms must explicitly define and consistently handle special values like NaN, infinity, and edge cases across all mathematical operations. Special values can significantly impact computational results and should not be treated as afterthoughts.
Key requirements:
Example from PromQL aggregation functions:
// Good: Explicit NaN handling documentation
`quantile(phi, v)` calculates the φ-quantile, with NaN considered
the smallest possible value for ranking purposes.
// Good: Special case documentation
Special case for native histograms: NaN observations are considered
outside of any buckets. `histogram_fraction(-Inf, +Inf, b)` may
therefore be less than 1.
This prevents unexpected behavior and ensures algorithmic correctness, especially in statistical and mathematical computations where special values have well-defined meanings.
Enter the URL of a public GitHub repository