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

mul_add documentation is inaccurate #49842

Closed
vks opened this issue Apr 10, 2018 · 2 comments
Closed

mul_add documentation is inaccurate #49842

vks opened this issue Apr 10, 2018 · 2 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug.

Comments

@vks
Copy link
Contributor

vks commented Apr 10, 2018

According to the documentation of mul_add:

This produces a more accurate result with better performance than a separate multiplication operation followed by an add.

This seems not to be true in general. On my machine, a.mul_add(b, c) is slower than a * b + c when compiling without target-cpu=native.

@vks
Copy link
Contributor Author

vks commented Apr 10, 2018

cc @pitdicker

@hanna-kruppe
Copy link
Contributor

cc #44805, dedicated FMA instructions are not universally available and we can't very well replace a.mul_add(b, c) with a * b + c when no such instruction exists (it rounds differently and also has different behavior when NaNs or infinities are involved).

@kennytm kennytm added A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. labels Apr 10, 2018
frewsxcv added a commit to frewsxcv/num-traits that referenced this issue May 20, 2018
frewsxcv added a commit to frewsxcv/num-traits that referenced this issue May 20, 2018
bors bot added a commit to rust-num/num-traits that referenced this issue May 21, 2018
70: Clarify in the docs that `mul_add` is not always faster. r=cuviper a=frewsxcv

More info:

- rust-lang/rust#49842
- rust-lang/rust#50572

Co-authored-by: Corey Farwell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants