3 ms·
Floats are evil. Here's a program: int main(int argc, char* argv[]) { double x = 0.75; double t1 = 0.50000025; int i, j; int n8 = 93 * 100;
by david-given 11y ago
Floats are evil.
Here's a program:
int main(int argc, char* argv[]) {
double x = 0.75;
double t1 = 0.50000025;
int i, j;
int n8 = 93 * 100;
for (i = 0;; i++) {
for (j = 0; j<n8; j++)
x = sqrt(exp(log(x) / t1));
printf("%d %f\n", i, x);
}
}
Watch what happens to the performance as i passes 4632.
The full saga is here; AFAICT it's a pathological edge case in glibc. https://plus.google.com/118274112180368285367/posts/ZPL5LTK9gpm https://plus.google.com/118274112180368285367/posts/ZPL5LTK9...