klyn.math.NDArray.operator/
method
public static operator/(notnull first as NDArray<T>, second as T) as NDArray<T>
Description

Divides every element by a scalar without modifying the source array. The result preserves the shape and element type, including FP32 storage for Float. Like array-to-array division, integer results truncate toward zero and floating results follow IEEE 754. Signed MIN_VALUE divided by -1 wraps to MIN_VALUE, consistently with fixed-width unary negation.

Parameters
ParameterDescription
firstArray to divide.
secondDivisor of the array's element type.
Returns

A new array with independent element storage.

Throws
  • ZeroDivisionException for an integer zero divisor.
  • NullException if first is null at runtime; statically null arguments are rejected with TypeError.
Example
import klyn.math
pixels = NDArray<Float>([0f, 127.5f, 255f])
normalized = pixels / 255f  # [0.0, 0.5, 1.0]