reduce.c file
Functions
-
static auto neumaier_step(const vm_
float_ t sum, vm_ float_ t* comp, const vm_ float_ t x) -> vm_ float_ t - One Neumaier step.
-
auto vm_sum_compensated(const vm_
float_ t* x, int n) -> vm_ float_ t - Neumaier sum of
x[0..n). -
auto vm_dot_compensated(const vm_
float_ t* a, const vm_ float_ t* b, int n) -> vm_ float_ t - Neumaier dot product of
aandb. -
auto vm_array_minmax(vm_
float_ t* min_value, vm_ float_ t* max_value, const vm_ float_ t* x, int n) -> bool - Minimum and maximum, ignoring NaNs.
Function documentation
static vm_ float_ t neumaier_step(const vm_ float_ t sum,
vm_ float_ t* comp,
const vm_ float_ t x)
One Neumaier step.
t is stored so the lost low part survives optimization.
vm_ float_ t vm_sum_compensated(const vm_ float_ t* x,
int n)
| Returns | Compensated sum, or +0 when n <= 0. |
|---|
n <= 0 returns +0 and does not read. On finite non-overflow inputs with n <= 10^6, the absolute error is at most 16 eps × sum(|terms|). The same binary and input repeat.
vm_ float_ t vm_dot_compensated(const vm_ float_ t* a,
const vm_ float_ t* b,
int n)
Neumaier dot product of a and b.
| Parameters | |
|---|---|
| a | Left input; length n. Ignored when n <= 0. |
| b | Right input; length n. May exactly alias a. |
| n | |
| Returns | Compensated dot, or +0 when n <= 0. |
The product is formed in vm_, then compensated. a may exactly alias b. n <= 0 returns +0 and does not read. The absolute-error target matches vm_.
bool vm_array_minmax(vm_ float_ t* min_value,
vm_ float_ t* max_value,
const vm_ float_ t* x,
int n)
Minimum and maximum, ignoring NaNs.
| Parameters | |
|---|---|
| min_value | Output minimum. Unchanged on failure. |
| max_value | Output maximum. Unchanged on failure. |
| x | |
| n | |
| Returns | true when at least one non-NaN value was seen. |
n <= 0, a missing pointer, or an all-NaN input returns false and leaves *min_value and *max_value unchanged. Infinities count. The minimum of ±0 is −0 and the maximum is +0. A selected finite or infinite value is exact.