News for hackers. Stuff that matters.
Re:Bisecting Floating Point Numbers by david-given on Monday November 09, 2015 @12:16PM (#10534271)
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/ZPL5LTK9...

There are no comments on this comment yet.