Function divideInto
Divides corresponding left samples by right samples into destination.
bool divideInto(T)(
scope RasterView!T left,
size_t leftPlaneIndex,
scope RasterView!T right,
size_t rightPlaneIndex,
scope ref WritableRasterView!T destination,
size_t destinationPlaneIndex,
out RasterZipTransformError error
) nothrow @nogc @safe
if (isRasterArithmeticFloating!T);
Supported T:
float, double
Result semantics are D/IEEE-754 floating division in T.
Therefore, without any raster-d pre-scan or special-case branch:
- finite nonzero division rounds according to the active IEEE rounding mode; - finite nonzero / signed zero produces signed infinity as defined by IEEE; - zero / zero produces NaN; - finite overflow may produce infinity; - underflow may produce a subnormal or signed zero; - NaN and infinity propagate according to D/IEEE semantics.
Integer division is intentionally not part of this wrapper because its runtime undefined cases cannot be represented honestly through the existing zipTransformInto failure channel without a separate pre-scan or execution engine.
Structural, alias, failure, allocation and execution semantics are inherited unchanged from zipTransformInto().
Example
Example showing that arithmetic wrappers preserve zip failure semantics.
import raster;
RasterView!float left;
RasterView!float right;
WritableRasterView!float destination;
RasterZipTransformError error;
assert(
!left .divideInto(
0,
right,
0,
destination,
0,
error
)
);
assert(
error
== RasterZipTransformError .invalidLeftPlane
);