Average Error: 15.4 → 14.9
Time: 1.3m
Precision: 64
\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
\[\frac{\mathsf{fma}\left(\sqrt{\frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1}, 1, \mathsf{fma}\left(1, 1, \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1\right)\right) \cdot \left(1 \cdot \left(1 \cdot 1\right)\right) - \mathsf{fma}\left(\sqrt{\frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1}, 1, \mathsf{fma}\left(1, 1, \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1\right)\right) \cdot \left(\sqrt{\frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1} \cdot \left(\frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1\right)\right)}{\mathsf{fma}\left(\sqrt{\frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1}, 1, \mathsf{fma}\left(1, 1, \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1\right)\right) \cdot \mathsf{fma}\left(\sqrt{\frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1}, 1, \mathsf{fma}\left(1, 1, \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1\right)\right)}\]
1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\frac{\mathsf{fma}\left(\sqrt{\frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1}, 1, \mathsf{fma}\left(1, 1, \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1\right)\right) \cdot \left(1 \cdot \left(1 \cdot 1\right)\right) - \mathsf{fma}\left(\sqrt{\frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1}, 1, \mathsf{fma}\left(1, 1, \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1\right)\right) \cdot \left(\sqrt{\frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1} \cdot \left(\frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1\right)\right)}{\mathsf{fma}\left(\sqrt{\frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1}, 1, \mathsf{fma}\left(1, 1, \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1\right)\right) \cdot \mathsf{fma}\left(\sqrt{\frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1}, 1, \mathsf{fma}\left(1, 1, \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)} + 0.5 \cdot 1\right)\right)}
double f(double x) {
        double r11188860 = 1.0;
        double r11188861 = 0.5;
        double r11188862 = x;
        double r11188863 = hypot(r11188860, r11188862);
        double r11188864 = r11188860 / r11188863;
        double r11188865 = r11188860 + r11188864;
        double r11188866 = r11188861 * r11188865;
        double r11188867 = sqrt(r11188866);
        double r11188868 = r11188860 - r11188867;
        return r11188868;
}

double f(double x) {
        double r11188869 = 0.5;
        double r11188870 = 1.0;
        double r11188871 = r11188869 * r11188870;
        double r11188872 = x;
        double r11188873 = hypot(r11188870, r11188872);
        double r11188874 = r11188871 / r11188873;
        double r11188875 = r11188874 + r11188871;
        double r11188876 = sqrt(r11188875);
        double r11188877 = fma(r11188870, r11188870, r11188875);
        double r11188878 = fma(r11188876, r11188870, r11188877);
        double r11188879 = r11188870 * r11188870;
        double r11188880 = r11188870 * r11188879;
        double r11188881 = r11188878 * r11188880;
        double r11188882 = r11188876 * r11188875;
        double r11188883 = r11188878 * r11188882;
        double r11188884 = r11188881 - r11188883;
        double r11188885 = r11188878 * r11188878;
        double r11188886 = r11188884 / r11188885;
        return r11188886;
}

Error

Bits error versus x

Derivation

  1. Initial program 15.4

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

    \[\leadsto \color{blue}{\frac{{1}^{3} - {\left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{3}}{1 \cdot 1 + \left(\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 \cdot \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}}\]
  4. Simplified15.4

    \[\leadsto \frac{\color{blue}{1 \cdot \left(1 \cdot 1\right) - \left(0.5 \cdot 1 + \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot \sqrt{0.5 \cdot 1 + \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)}}}}{1 \cdot 1 + \left(\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 \cdot \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}\]
  5. Simplified14.9

    \[\leadsto \frac{1 \cdot \left(1 \cdot 1\right) - \left(0.5 \cdot 1 + \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot \sqrt{0.5 \cdot 1 + \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)}}}{\color{blue}{\mathsf{fma}\left(\sqrt{0.5 \cdot 1 + \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)}}, 1, \mathsf{fma}\left(1, 1, 0.5 \cdot 1 + \frac{0.5 \cdot 1}{\mathsf{hypot}\left(1, x\right)}\right)\right)}}\]
  6. Using strategy rm
  7. Applied div-sub14.9

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

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

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

Reproduce

herbie shell --seed 2019169 +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)))))))