Average Error: 15.3 → 14.8
Time: 1.0m
Precision: 64
\[1 - \sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
\[\frac{\frac{1}{2} - \frac{\frac{1}{2}}{\mathsf{hypot}\left(1, x\right)}}{\sqrt{\frac{1}{2} + \frac{\frac{1}{2}}{\mathsf{hypot}\left(1, x\right)}} + 1}\]
1 - \sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\frac{\frac{1}{2} - \frac{\frac{1}{2}}{\mathsf{hypot}\left(1, x\right)}}{\sqrt{\frac{1}{2} + \frac{\frac{1}{2}}{\mathsf{hypot}\left(1, x\right)}} + 1}
double f(double x) {
        double r31616805 = 1.0;
        double r31616806 = 0.5;
        double r31616807 = x;
        double r31616808 = hypot(r31616805, r31616807);
        double r31616809 = r31616805 / r31616808;
        double r31616810 = r31616805 + r31616809;
        double r31616811 = r31616806 * r31616810;
        double r31616812 = sqrt(r31616811);
        double r31616813 = r31616805 - r31616812;
        return r31616813;
}

double f(double x) {
        double r31616814 = 0.5;
        double r31616815 = 1.0;
        double r31616816 = x;
        double r31616817 = hypot(r31616815, r31616816);
        double r31616818 = r31616814 / r31616817;
        double r31616819 = r31616814 - r31616818;
        double r31616820 = r31616814 + r31616818;
        double r31616821 = sqrt(r31616820);
        double r31616822 = r31616821 + r31616815;
        double r31616823 = r31616819 / r31616822;
        return r31616823;
}

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{\frac{1}{2} \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
  2. Simplified15.3

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

    \[\leadsto \color{blue}{\frac{1 \cdot 1 - \sqrt{\frac{\frac{1}{2}}{\mathsf{hypot}\left(1, x\right)} + \frac{1}{2}} \cdot \sqrt{\frac{\frac{1}{2}}{\mathsf{hypot}\left(1, x\right)} + \frac{1}{2}}}{1 + \sqrt{\frac{\frac{1}{2}}{\mathsf{hypot}\left(1, x\right)} + \frac{1}{2}}}}\]
  5. Taylor expanded around inf 14.8

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

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

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

Reproduce

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