← Standard library

float32x4

struct float32x4

Available without an import.

A 128-bit SIMD value containing 4 float32 lanes. Arithmetic operates lane-wise. Lane and WithLane require constant indices; bracket indexing supports checked runtime indices. Comparisons return all-one/all-zero integer masks. Bit reinterpretation involving floating-point lanes canonicalizes NaNs.

api fn Main() : int32 {
    var values = new float32x4(1.0f, 2.0f, 3.0f, 4.0f);
    var mask = values.Gt(float32x4.Splat(2.0f));
    var selected = mask.Blend(values, float32x4.Zero());
    return selected.ReduceSum() as int32;
}

Simd.wax:1923

Members

Splatmethod

public static fn Splat(float value) : float32x4

Copies one scalar value into every lane.

Simd.wax:1929

Zeromethod

public static fn Zero() : float32x4

Returns a vector whose lanes are all zero.

Simd.wax:1933

constructorconstructor

public constructor (float l0, float l1, float l2, float l3)

Creates a vector from scalar lanes in ascending index order.

Simd.wax:1937

Lanemethod

public fn Lane(int32 index) : float

Reads a compile-time constant lane index in [0, 4). Invalid or nonconstant indices are rejected; use bracket indexing for runtime indices.

Simd.wax:1942

ReduceSummethod

public fn ReduceSum() : float

Sums every lane into the scalar result. Uses a pairwise tree, so rounding can differ from a left-to-right scalar sum.

Simd.wax:1947

ReduceMinmethod

public fn ReduceMin() : float

Reduces all lanes to their minimum. Uses pairwise SIMD Min rules; ties and NaNs follow receiver preference, not scalar Math.Min.

Simd.wax:1952

ReduceMaxmethod

public fn ReduceMax() : float

Reduces all lanes to their maximum. Uses pairwise SIMD Max rules; ties and NaNs follow receiver preference, not scalar Math.Max.

Simd.wax:1957

Minmethod

public fn Min(float32x4 other) : float32x4

Selects the smaller value in each lane. Uses other < this ? other : this: ties and unordered NaN comparisons retain the receiver lane, unlike scalar Math.Min.

Simd.wax:1962

Maxmethod

public fn Max(float32x4 other) : float32x4

Selects the larger value in each lane. Uses this < other ? other : this: ties and unordered NaN comparisons retain the receiver lane, unlike scalar Math.Max.

Simd.wax:1967

Absmethod

public fn Abs() : float32x4

Clears each floating-point sign bit.

Simd.wax:1971

Sqrtmethod

public fn Sqrt() : float32x4

Computes a square root per lane; negative lanes produce NaN.

Simd.wax:1975

Rsqrtmethod

public fn Rsqrt() : float32x4

Computes 1/sqrt(value) per lane using square root and division, not a hardware approximation.

Simd.wax:1980

Floormethod

public fn Floor() : float32x4

Rounds each lane toward negative infinity.

Simd.wax:1984

Eqmethod

public fn Eq(float32x4 other) : int32x4

Compares corresponding lanes for equal, returning all-one bits for true and all-zero bits for false. NaN comparisons are false except Ne, which is true.

Simd.wax:1989

Nemethod

public fn Ne(float32x4 other) : int32x4

Compares corresponding lanes for unequal, returning all-one bits for true and all-zero bits for false. NaN comparisons are false except Ne, which is true.

Simd.wax:1994

Ltmethod

public fn Lt(float32x4 other) : int32x4

Compares corresponding lanes for less, returning all-one bits for true and all-zero bits for false. NaN comparisons are false except Ne, which is true.

Simd.wax:1999

Lemethod

public fn Le(float32x4 other) : int32x4

Compares corresponding lanes for less or equal, returning all-one bits for true and all-zero bits for false. NaN comparisons are false except Ne, which is true.

Simd.wax:2004

Gtmethod

public fn Gt(float32x4 other) : int32x4

Compares corresponding lanes for greater, returning all-one bits for true and all-zero bits for false. NaN comparisons are false except Ne, which is true.

Simd.wax:2009

Gemethod

public fn Ge(float32x4 other) : int32x4

Compares corresponding lanes for greater or equal, returning all-one bits for true and all-zero bits for false. NaN comparisons are false except Ne, which is true.

Simd.wax:2014

WithLanemethod

public fn WithLane(int32 index, float value) : float32x4

Returns a copy with one lane replaced. The index must be a compile-time constant in [0, 4); use bracket assignment for runtime indices.

Simd.wax:2021

Shufflemethod

public fn Shuffle(int32 l0, int32 l1, int32 l2, int32 l3) : float32x4

Returns lanes selected in argument order. Every index must be a compile-time constant in [0, 4); repeats are allowed.

Simd.wax:2026

AsInt8x16method

public fn AsInt8x16() : int8x16

Reinterprets this 128-bit value with the destination lane shape rather than converting numerically. Floating-point NaN lanes are canonicalized on either side of the reinterpretation; NaN payload bits are not preserved.

Simd.wax:2032

AsUint8x16method

public fn AsUint8x16() : uint8x16

Reinterprets this 128-bit value with the destination lane shape rather than converting numerically. Floating-point NaN lanes are canonicalized on either side of the reinterpretation; NaN payload bits are not preserved.

Simd.wax:2038

AsInt16x8method

public fn AsInt16x8() : int16x8

Reinterprets this 128-bit value with the destination lane shape rather than converting numerically. Floating-point NaN lanes are canonicalized on either side of the reinterpretation; NaN payload bits are not preserved.

Simd.wax:2044

AsUint16x8method

public fn AsUint16x8() : uint16x8

Reinterprets this 128-bit value with the destination lane shape rather than converting numerically. Floating-point NaN lanes are canonicalized on either side of the reinterpretation; NaN payload bits are not preserved.

Simd.wax:2050

AsInt32x4method

public fn AsInt32x4() : int32x4

Reinterprets this 128-bit value with the destination lane shape rather than converting numerically. Floating-point NaN lanes are canonicalized on either side of the reinterpretation; NaN payload bits are not preserved.

Simd.wax:2056

AsUint32x4method

public fn AsUint32x4() : uint32x4

Reinterprets this 128-bit value with the destination lane shape rather than converting numerically. Floating-point NaN lanes are canonicalized on either side of the reinterpretation; NaN payload bits are not preserved.

Simd.wax:2062

AsInt64x2method

public fn AsInt64x2() : int64x2

Reinterprets this 128-bit value with the destination lane shape rather than converting numerically. Floating-point NaN lanes are canonicalized on either side of the reinterpretation; NaN payload bits are not preserved.

Simd.wax:2068

AsUint64x2method

public fn AsUint64x2() : uint64x2

Reinterprets this 128-bit value with the destination lane shape rather than converting numerically. Floating-point NaN lanes are canonicalized on either side of the reinterpretation; NaN payload bits are not preserved.

Simd.wax:2074

AsFloat64x2method

public fn AsFloat64x2() : float64x2

Reinterprets this 128-bit value with the destination lane shape rather than converting numerically. Floating-point NaN lanes are canonicalized on either side of the reinterpretation; NaN payload bits are not preserved.

Simd.wax:2080

ToInt32x4method

public fn ToInt32x4() : int32x4

Truncates floating-point lanes toward zero with saturation to int32. NaNs become zero and out-of-range values clamp to integer bounds.

Simd.wax:2087

Loadmethod

public static fn Load(Span<uint8> data, int32 byteOffset) : float32x4

Reads 16 bytes starting at byteOffset as this lane type. The complete range must fit the span or the operation panics. No alignment requirement is imposed.

Simd.wax:2092

LoadAlignedmethod

public static fn LoadAligned(Span<uint8> data, int32 byteOffset) : float32x4

Reads 16 bytes with the same bounds checks and behavior as Load. Alignment is a hint; unaligned addresses are accepted.

Simd.wax:2097

Storemethod

public fn Store(Span<uint8> data, int32 byteOffset) : void

Writes all 16 bytes at byteOffset. The complete range must fit the span or the operation panics. Does not resize or retain the span.

Simd.wax:2102

LoadElemsmethod

public static fn LoadElems(Span<float> data, int32 elemIndex) : float32x4

Reads 4 consecutive elements starting at elemIndex. The whole element range must fit or the operation panics; indices count elements, not bytes.

Simd.wax:2107

StoreElemsmethod

public fn StoreElems(Span<float> data, int32 elemIndex) : void

Writes 4 consecutive elements starting at elemIndex. The whole element range must fit or the operation panics; indices count elements, not bytes.

Simd.wax:2112

ToStringmethod

public fn ToString() : string

Provided by the compiler.

ToStringBuffermethod

public fn ToStringBuffer(StringBuilder builder) : int32

Provided by the compiler.