1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! Arithmetic operators for numeric computations.
//!
//! Submodules:
//! - [`basic`] — `+`, `-`, `*` with overflow promotion to `f64`.
//! - [`div_mod`] — `/` and `%` with config-aware divbyzero handling.
//! - [`min_max`] — `min` and `max` (array reduction + variadic).
//! - [`unary_math`] — `abs` / `ceil` / `floor` (gated on `ext-math`).
//! - [`helpers`] — shared NaN handling, coercion-pair, integer/float fold.
//!
//! Datetime/duration arithmetic moved to `crate::operators::datetime::arith`
//! (consolidated under the `datetime/` tree); arithmetic ops reach into it
//! via `crate::operators::datetime` for the gated `+`/`-`/`*`/`/`/`%` cases.
//!
//! ## Overflow handling
//!
//! All arithmetic operators use the same pattern for overflow protection:
//!
//! 1. **Track integer precision**: stay in `i64` while operands fit.
//! 2. **Checked arithmetic**: `checked_add`/`checked_mul` etc.
//! 3. **Overflow promotion**: on overflow, switch to `f64` and continue
//! accumulating.
//! 4. **Result preservation**: return `i64` when possible, `f64` otherwise.
//!
//! The integer-checked-with-float-fallback pattern is centralised in
//! [`helpers::try_int_op`] for the 2-arg ops and in
//! [`helpers::variadic_fold`] for variadic ops.
//!
//! ## NaN handling
//!
//! When a value cannot be coerced to a number, behavior depends on
//! `NanHandling` config: `ThrowError` (default), `IgnoreValue`,
//! `CoerceToZero`, or `ReturnNull`.
pub use ;
pub use ;
pub use ;
pub use ;