← Back to archive

Stdle #155 · simd · 2026-11-08

What does this Zig snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

const std = @import("std");
pub fn main() void {
const v: @Vector(4, f32) = .{ 1.0, 2.0, 3.0, 4.0 };
const s: @Vector(4, f32) = @splat(2.0);
const result = v * s;
std.debug.print("{d:.0} {d:.0}\n", .{ result[0], result[3] });
}
SIMD
4 attempts left

Answer & explanation