Average Error: 15.2 → 14.7
Time: 3.6s
Precision: binary64
\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
\[\frac{\log \left(e^{1 \cdot \left(1 - 0.5\right) - 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)}}\right)}{\left(\sqrt{0.5} \cdot \sqrt{\sqrt{1 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)} + 1}}\right) \cdot \sqrt{\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{\log \left(e^{1 \cdot \left(1 - 0.5\right) - 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)}}\right)}{\left(\sqrt{0.5} \cdot \sqrt{\sqrt{1 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)} + 1}}\right) \cdot \sqrt{\sqrt{1 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)} + 1}} + 1}
double code(double x) {
	return ((double) (1.0 - ((double) sqrt(((double) (0.5 * ((double) (1.0 + ((double) (1.0 / ((double) hypot(1.0, x))))))))))));
}
double code(double x) {
	return ((double) (((double) log(((double) exp(((double) (((double) (1.0 * ((double) (1.0 - 0.5)))) - ((double) (0.5 * ((double) (1.0 / ((double) hypot(1.0, x)))))))))))) / ((double) (((double) (((double) (((double) sqrt(0.5)) * ((double) sqrt(((double) sqrt(((double) (((double) (1.0 * ((double) (1.0 / ((double) hypot(1.0, x)))))) + 1.0)))))))) * ((double) sqrt(((double) sqrt(((double) (((double) (1.0 * ((double) (1.0 / ((double) hypot(1.0, x)))))) + 1.0)))))))) + 1.0))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 15.2

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

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

    \[\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-log-exp14.7

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

    \[\leadsto \frac{\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)}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\]
  8. Applied diff-log14.7

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

    \[\leadsto \frac{\log \color{blue}{\left(e^{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)}}\]
  10. Taylor expanded around 0 14.7

    \[\leadsto \frac{\log \left(e^{1 \cdot \left(1 - 0.5\right) - 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)}}\right)}{\color{blue}{\sqrt{0.5} \cdot \sqrt{1 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)} + 1} + 1}}\]
  11. Using strategy rm
  12. Applied add-sqr-sqrt14.7

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

    \[\leadsto \frac{\log \left(e^{1 \cdot \left(1 - 0.5\right) - 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)}}\right)}{\sqrt{0.5} \cdot \color{blue}{\left(\sqrt{\sqrt{1 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)} + 1}} \cdot \sqrt{\sqrt{1 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)} + 1}}\right)} + 1}\]
  14. Applied associate-*r*14.7

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

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

Reproduce

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