Average Error: 15.6 → 15.1
Time: 3.4s
Precision: 64
\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
\[\frac{e^{\log \left(\log \left(e^{1 \cdot \left(1 - 0.5\right) - 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)}}\right)\right)}}{\sqrt{0.5} \cdot \sqrt{1 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)} + 1} + 1}\]
1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\frac{e^{\log \left(\log \left(e^{1 \cdot \left(1 - 0.5\right) - 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)}}\right)\right)}}{\sqrt{0.5} \cdot \sqrt{1 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)} + 1} + 1}
double f(double x) {
        double r128942 = 1.0;
        double r128943 = 0.5;
        double r128944 = x;
        double r128945 = hypot(r128942, r128944);
        double r128946 = r128942 / r128945;
        double r128947 = r128942 + r128946;
        double r128948 = r128943 * r128947;
        double r128949 = sqrt(r128948);
        double r128950 = r128942 - r128949;
        return r128950;
}

double f(double x) {
        double r128951 = 1.0;
        double r128952 = 0.5;
        double r128953 = r128951 - r128952;
        double r128954 = r128951 * r128953;
        double r128955 = x;
        double r128956 = hypot(r128951, r128955);
        double r128957 = r128951 / r128956;
        double r128958 = r128952 * r128957;
        double r128959 = r128954 - r128958;
        double r128960 = exp(r128959);
        double r128961 = log(r128960);
        double r128962 = log(r128961);
        double r128963 = exp(r128962);
        double r128964 = sqrt(r128952);
        double r128965 = 1.0;
        double r128966 = r128965 / r128956;
        double r128967 = r128951 * r128966;
        double r128968 = r128967 + r128951;
        double r128969 = sqrt(r128968);
        double r128970 = r128964 * r128969;
        double r128971 = r128970 + r128951;
        double r128972 = r128963 / r128971;
        return r128972;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 15.6

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

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

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

    \[\leadsto \frac{\color{blue}{e^{\log \left(1 \cdot \left(1 - 0.5\right) - 0.5 \cdot \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 add-log-exp15.1

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

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

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

    \[\leadsto \frac{e^{\log \left(\log \color{blue}{\left(e^{1 \cdot \left(1 - 0.5\right) - 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)}}\right)}\right)}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\]
  12. Taylor expanded around 0 15.1

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

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

Reproduce

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