Average Error: 15.1 → 14.6
Time: 21.1s
Precision: 64
\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
\[\frac{\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(1 \cdot {1}^{3} - {\left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{4}\right)\right)}{\mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot 1\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{\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(1 \cdot {1}^{3} - {\left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{4}\right)\right)}{\mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot 1\right)}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}
double f(double x) {
        double r258279 = 1.0;
        double r258280 = 0.5;
        double r258281 = x;
        double r258282 = hypot(r258279, r258281);
        double r258283 = r258279 / r258282;
        double r258284 = r258279 + r258283;
        double r258285 = r258280 * r258284;
        double r258286 = sqrt(r258285);
        double r258287 = r258279 - r258286;
        return r258287;
}

double f(double x) {
        double r258288 = 1.0;
        double r258289 = 3.0;
        double r258290 = pow(r258288, r258289);
        double r258291 = r258288 * r258290;
        double r258292 = 0.5;
        double r258293 = x;
        double r258294 = hypot(r258288, r258293);
        double r258295 = r258288 / r258294;
        double r258296 = r258288 + r258295;
        double r258297 = r258292 * r258296;
        double r258298 = sqrt(r258297);
        double r258299 = 4.0;
        double r258300 = pow(r258298, r258299);
        double r258301 = r258291 - r258300;
        double r258302 = log1p(r258301);
        double r258303 = expm1(r258302);
        double r258304 = r258288 * r258288;
        double r258305 = fma(r258292, r258296, r258304);
        double r258306 = r258303 / r258305;
        double r258307 = r258288 + r258298;
        double r258308 = r258306 / r258307;
        return r258308;
}

Error

Bits error versus x

Derivation

  1. Initial program 15.1

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

    \[\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.6

    \[\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. Simplified14.6

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

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

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

    \[\leadsto \frac{\frac{1 \cdot {1}^{3} - {\left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{\left(3 + 1\right)}}{\color{blue}{\mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot 1\right)}}}{\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1}\]
  10. Using strategy rm
  11. Applied add-log-exp15.1

    \[\leadsto \frac{\frac{1 \cdot {1}^{3} - \color{blue}{\log \left(e^{{\left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{\left(3 + 1\right)}}\right)}}{\mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot 1\right)}}{\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1}\]
  12. Applied add-log-exp15.1

    \[\leadsto \frac{\frac{\color{blue}{\log \left(e^{1 \cdot {1}^{3}}\right)} - \log \left(e^{{\left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{\left(3 + 1\right)}}\right)}{\mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot 1\right)}}{\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1}\]
  13. Applied diff-log15.1

    \[\leadsto \frac{\frac{\color{blue}{\log \left(\frac{e^{1 \cdot {1}^{3}}}{e^{{\left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{\left(3 + 1\right)}}}\right)}}{\mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot 1\right)}}{\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1}\]
  14. Simplified14.6

    \[\leadsto \frac{\frac{\log \color{blue}{\left(e^{1 \cdot {1}^{3} - {\left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{4}}\right)}}{\mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot 1\right)}}{\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1}\]
  15. Using strategy rm
  16. Applied expm1-log1p-u14.6

    \[\leadsto \frac{\frac{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\log \left(e^{1 \cdot {1}^{3} - {\left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{4}}\right)\right)\right)}}{\mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot 1\right)}}{\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1}\]
  17. Simplified14.6

    \[\leadsto \frac{\frac{\mathsf{expm1}\left(\color{blue}{\mathsf{log1p}\left(1 \cdot {1}^{3} - {\left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{4}\right)}\right)}{\mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot 1\right)}}{\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1}\]
  18. Final simplification14.6

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

Reproduce

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