-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-lintArea: New lintsArea: New lintsL-perfLint: Belongs in the perf lint groupLint: Belongs in the perf lint group
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).
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsL-perfLint: Belongs in the perf lint groupLint: Belongs in the perf lint group