round_i32 added 0.5 in f32, which rounds up at the binade crossing:
0.49999997 (0.5 - 2^-25) + 0.5 becomes 1.0, so round_i32 gave 1 (and -1 for
the negative) where f32::round gives 0. The sum is now taken in f64, where
it is exact for every f32 the i32 cast does not saturate; still no roundf call.
rounding_matches_the_standard_library now covers +-0.49999997, the ties and
8388607.5, and a new test compares every f32 bit pattern in [-4096, 4096]
against f32::round (0.6 s). Both fail on the previous head. The code comment
and docs/oil-paint-performance.md no longer claim the f32 sum is exact.
Co-authored-by: ebosido444-ai <316167330+ebosido444-ai@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The line integral convolution takes 21 bilinear samples and 20 tangent lookups per
output pixel, and every one of those computed its coordinate with `f32::floor` or
`f32::round`. On the baseline x86-64 target both lower to library calls (`jmp floorf`
and `jmp roundf` in `rustc --emit asm`), so the filter spent most of its time in 82
call-and-return pairs per pixel.
`sample()` now truncates the coordinate it already clamped to the window, and the
tangent and bristle lookups use `round_i32`/`round_index`, which produce the same
integer for every position a tile can produce.
The output is bit-identical: six 600x400 fixtures (default, short, long, unlit, RGB
without alpha, CMYK) compare sample for sample with `cmp` and a per-channel maximum
delta of 0.0. 24 MP Oil Paint is 1.88x faster on the minimum of five alternating pairs,
measured on a contended 4-core machine; docs/oil-paint-performance.md has the numbers,
that caveat and the alternatives that were measured and rejected.