internal/asm/f64: AMD64 L1Norm/L1NormInc mishandle repeated +Inf and zero stride
Author: jamestjspCreated Sep 8, 2026Updated Sep 8, 2026
Upstream master 2b52c28fc756441b75b3af99cddc1649f4439ded; AMD64 ASM, no SIMD experiment.
Save as asm_l1_repro_test.go in the repository root. Run:
GOEXPERIMENT= go test -run '^TestUpstreamL1' -count=1 -timeout=5s .Add -tags noasm for the passing control.
package gonum_test
import (
"gonum.org/v1/gonum/internal/asm/f64"
"math"
"testing"
)
func TestUpstreamL1(t *testing.T) {
inf := math.Inf(1)
t.Run("unitary", func(t *testing.T) {
if got := f64.L1Norm([]float64{inf, inf}); !math.IsInf(got, 1) {
t.Fatalf("got %g want +Inf", got)
}
})
t.Run("strided", func(t *testing.T) {
if got := f64.L1NormInc([]float64{inf, 0, inf}, 2, 2); !math.IsInf(got, 1) {
t.Fatalf("got %g want +Inf", got)
}
})
t.Run("zero_stride", func(t *testing.T) {
if got := f64.L1NormInc([]float64{3}, 2, 0); got != 0 {
t.Fatalf("got %g want 0", got)
}
})
}Go 1.27.1/Rosetta: original returns NaN, NaN, 6; repaired ASM and noasm controls pass. Native AMD64 pending.
Source: gonum/gonum