Average Error: 15.3 → 14.8
Time: 10.0s
Precision: 64
\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
\[\frac{1 \cdot \left(1 - 0.5\right) - 0.5 \cdot \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\]
1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\frac{1 \cdot \left(1 - 0.5\right) - 0.5 \cdot \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}
double f(double x) {
        double r170470 = 1.0;
        double r170471 = 0.5;
        double r170472 = x;
        double r170473 = hypot(r170470, r170472);
        double r170474 = r170470 / r170473;
        double r170475 = r170470 + r170474;
        double r170476 = r170471 * r170475;
        double r170477 = sqrt(r170476);
        double r170478 = r170470 - r170477;
        return r170478;
}

double f(double x) {
        double r170479 = 1.0;
        double r170480 = 0.5;
        double r170481 = r170479 - r170480;
        double r170482 = r170479 * r170481;
        double r170483 = x;
        double r170484 = hypot(r170479, r170483);
        double r170485 = sqrt(r170484);
        double r170486 = r170479 / r170485;
        double r170487 = r170486 / r170485;
        double r170488 = r170480 * r170487;
        double r170489 = r170482 - r170488;
        double r170490 = r170479 / r170484;
        double r170491 = r170479 + r170490;
        double r170492 = r170480 * r170491;
        double r170493 = sqrt(r170492);
        double r170494 = r170479 + r170493;
        double r170495 = r170489 / r170494;
        return r170495;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 15.3

    \[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
  2. Using strategy rm
  3. Applied flip--15.3

    \[\leadsto \color{blue}{\frac{1 \cdot 1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} \cdot \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}}\]
  4. Simplified14.8

    \[\leadsto \frac{\color{blue}{1 \cdot 1 - 0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt14.9

    \[\leadsto \frac{1 \cdot 1 - 0.5 \cdot \left(1 + \frac{1}{\color{blue}{\sqrt{\mathsf{hypot}\left(1, x\right)} \cdot \sqrt{\mathsf{hypot}\left(1, x\right)}}}\right)}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\]
  7. Applied associate-/r*14.8

    \[\leadsto \frac{1 \cdot 1 - 0.5 \cdot \left(1 + \color{blue}{\frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}\right)}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\]
  8. Using strategy rm
  9. Applied distribute-lft-in14.8

    \[\leadsto \frac{1 \cdot 1 - \color{blue}{\left(0.5 \cdot 1 + 0.5 \cdot \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\mathsf{hypot}\left(1, x\right)}}\right)}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\]
  10. Applied associate--r+14.8

    \[\leadsto \frac{\color{blue}{\left(1 \cdot 1 - 0.5 \cdot 1\right) - 0.5 \cdot \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\]
  11. Simplified14.8

    \[\leadsto \frac{\color{blue}{1 \cdot \left(1 - 0.5\right)} - 0.5 \cdot \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\]
  12. Final simplification14.8

    \[\leadsto \frac{1 \cdot \left(1 - 0.5\right) - 0.5 \cdot \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\]

Reproduce

herbie shell --seed 2020042 
(FPCore (x)
  :name "Given's Rotation SVD example, simplified"
  :precision binary64
  (- 1 (sqrt (* 0.5 (+ 1 (/ 1 (hypot 1 x)))))))