Function trySumFloatToDouble

Sums one logical float plane into a double result using the strict row-major reduction semantic.

bool trySumFloatToDouble(
  scope RasterView!(float) source,
  ulong planeIndex,
  out double sum
) nothrow @nogc @safe;

All validated resident layouts are semantically supported. A valid empty plane succeeds with sum == 0.0.

Returns false only when planeIndex does not select a logical source plane. On failure sum is reset to 0.0.

The operation is allocation-free and does not retain source.

Example

Example observing failure and output reset for an invalid plane.

import raster;
RasterView!float source;
double sum = 42.0;
assert(!trySumFloatToDouble(source, 0, sum));
assert(sum == 0.0);