Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lint request] mul_add #4001

Open
gnzlbg opened this issue Apr 18, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@gnzlbg
Copy link
Contributor

commented Apr 18, 2019

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).

@oli-obk

This comment has been minimized.

Copy link
Collaborator

commented Apr 24, 2019

I think it's fine for a perf lint to change corner case semantics slightly. If the change is truly undesired, the lint can be allowed and a comment placed as to why the change is not desirable at the given location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.