Average Error: 15.5 → 15.0
Time: 16.5s
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) - \left(\sqrt{\frac{1}{\mathsf{hypot}\left(1, x\right)}} \cdot \sqrt{\frac{1}{\mathsf{hypot}\left(1, x\right)}}\right) \cdot 0.5}{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) - \left(\sqrt{\frac{1}{\mathsf{hypot}\left(1, x\right)}} \cdot \sqrt{\frac{1}{\mathsf{hypot}\left(1, x\right)}}\right) \cdot 0.5}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}
double f(double x) {
        double r126701 = 1.0;
        double r126702 = 0.5;
        double r126703 = x;
        double r126704 = hypot(r126701, r126703);
        double r126705 = r126701 / r126704;
        double r126706 = r126701 + r126705;
        double r126707 = r126702 * r126706;
        double r126708 = sqrt(r126707);
        double r126709 = r126701 - r126708;
        return r126709;
}

double f(double x) {
        double r126710 = 1.0;
        double r126711 = 0.5;
        double r126712 = r126710 - r126711;
        double r126713 = r126710 * r126712;
        double r126714 = x;
        double r126715 = hypot(r126710, r126714);
        double r126716 = r126710 / r126715;
        double r126717 = sqrt(r126716);
        double r126718 = r126717 * r126717;
        double r126719 = r126718 * r126711;
        double r126720 = r126713 - r126719;
        double r126721 = r126710 + r126716;
        double r126722 = r126711 * r126721;
        double r126723 = sqrt(r126722);
        double r126724 = r126710 + r126723;
        double r126725 = r126720 / r126724;
        return r126725;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 15.5

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

    \[\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. Simplified15.0

    \[\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-sqrt15.0

    \[\leadsto \frac{1 \cdot 1 - 0.5 \cdot \left(1 + \color{blue}{\sqrt{\frac{1}{\mathsf{hypot}\left(1, x\right)}} \cdot \sqrt{\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)}}\]
  7. Using strategy rm
  8. Applied distribute-rgt-in15.0

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

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

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

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

Reproduce

herbie shell --seed 2019195 +o rules:numerics
(FPCore (x)
  :name "Given's Rotation SVD example, simplified"
  (- 1.0 (sqrt (* 0.5 (+ 1.0 (/ 1.0 (hypot 1.0 x)))))))