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

Reciprocal estimate not accurate enough #4319

Open
pmatos opened this issue Jan 31, 2025 · 1 comment
Open

Reciprocal estimate not accurate enough #4319

pmatos opened this issue Jan 31, 2025 · 1 comment

Comments

@pmatos
Copy link
Collaborator

pmatos commented Jan 31, 2025

Currently on systems with rpres extension we generate frecpe for a pfrcp. The AMD manual mentions:

The maximum error is less than or equal to 1.5 * 2^–12 times the true reciprocal.

Unfortunately for, for example 1.0, the result of frecpe is 0.998047. The result should be within (1.00037 | 0.999634) to be within the required accuracy.

Should check other functions as well.

@pmatos
Copy link
Collaborator Author

pmatos commented Jan 31, 2025

Test:

#include <stdio.h>

int main(void) {
  float x = 1.0;

  float r;
  asm volatile("frecpe %s1, %s0" // 3DNow! reciprocal estimate
               : "=w"(r)         // Output: result (floating-point)
               : "w"(x)          // Input: x (floating-point)
  );
  printf("recip: %f\n", r);
  return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant