3 ms·
The point is not really that the compiler is able to spot the Gaussian sum. It uses a general infrastructure to turn many "math loops" that sum/multiply numbers
by jojomodding 10mo ago
The point is not really that the compiler is able to spot the Gaussian sum. It uses a general infrastructure to turn many "math loops" that sum/multiply numbers into closed-form solutions. This handles Gauss but is much more general. In turn it allows you to write simple code that still does the right thing, instead of a complicated-looking large multiplication with a bunch of random-seeming constants.