From ffb25b6657bdce713244ea8089c25aaba75b7f04 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 15 Oct 2026 20:51:58 +0200 Subject: [PATCH] cultmath: span tests: MaxMagnitude as a loop (a lambda cannot capture a struct's this); previous commit did not build the test project Co-Authored-By: Claude Opus 5.5 --- packages/cultmath/tests/CultMath.Tests/SpanStageTests.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/cultmath/tests/CultMath.Tests/SpanStageTests.cs b/packages/cultmath/tests/CultMath.Tests/SpanStageTests.cs index 8bd68193..f7db96c1 100644 --- a/packages/cultmath/tests/CultMath.Tests/SpanStageTests.cs +++ b/packages/cultmath/tests/CultMath.Tests/SpanStageTests.cs @@ -133,7 +133,13 @@ public sealed class SpanStageTests + Math.Sqrt(3.0) * scale * Norm() * path.speed * path.halfLength; } - public double MaxMagnitude(SpanPath path) => Enumerable.Range(0, Octaves).Max(o => Magnitude(path, o)); + public double MaxMagnitude(SpanPath path) + { + var largest = 0.0; + for (var o = 0; o < Octaves; o++) + largest = Math.Max(largest, Magnitude(path, o)); + return largest; + } // Octave o as a stage of its own: one octave at the scaled frequency, shift and offset. public Stage OneOctave(int octave) => new(