Closed
Description
Floating-point code of the form a * b + c
can be better optimized when written as a.mul_add(b, c)
, but this might change its result because instead of first computing a * b
, rounding that, and then adding c
to it, and rounding that, a.mul_add(b, c)
computes a * b + c
with infinite precision, and only rounds the end result.
I think it makes sense to recommend people by default that, if they don't care about their result being computed with higher-precission (and their results changing), they should prefer to use a.mul_add(b, c)
instead of a * b + c
(otherwise they can ignore the lint).