Skip to content

[lint request] mul_add #4001

Closed
Closed
@gnzlbg

Description

@gnzlbg

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

No one assigned

    Labels

    A-lintArea: New lintsL-perfLint: Belongs in the perf lint group

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions