Average Error: 15.4 → 14.9
Time: 5.7s
Precision: binary64
\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
\[\frac{\frac{\left(0.5 + \sqrt{{\left(\sqrt{\frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)}^{4}}\right) \cdot \left(0.5 - \sqrt{{\left(\sqrt{\frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)}^{4}}\right)}{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}\]
1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\frac{\frac{\left(0.5 + \sqrt{{\left(\sqrt{\frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)}^{4}}\right) \cdot \left(0.5 - \sqrt{{\left(\sqrt{\frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)}^{4}}\right)}{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}
(FPCore (x)
 :precision binary64
 (- 1.0 (sqrt (* 0.5 (+ 1.0 (/ 1.0 (hypot 1.0 x)))))))
(FPCore (x)
 :precision binary64
 (/
  (/
   (*
    (+ 0.5 (sqrt (pow (sqrt (/ 0.5 (hypot 1.0 x))) 4.0)))
    (- 0.5 (sqrt (pow (sqrt (/ 0.5 (hypot 1.0 x))) 4.0))))
   (+ 0.5 (/ 0.5 (hypot 1.0 x))))
  (+ 1.0 (sqrt (+ 0.5 (/ 0.5 (hypot 1.0 x)))))))
double code(double x) {
	return 1.0 - sqrt(0.5 * (1.0 + (1.0 / hypot(1.0, x))));
}
double code(double x) {
	return (((0.5 + sqrt(pow(sqrt(0.5 / hypot(1.0, x)), 4.0))) * (0.5 - sqrt(pow(sqrt(0.5 / hypot(1.0, x)), 4.0)))) / (0.5 + (0.5 / hypot(1.0, x)))) / (1.0 + sqrt(0.5 + (0.5 / hypot(1.0, x))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 15.4

    \[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
  2. Simplified15.4

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

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

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

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

    \[\leadsto \frac{\frac{\color{blue}{0.25 - {\left(\sqrt{\frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)}^{4}}}{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}\]
  9. Using strategy rm
  10. Applied add-sqr-sqrt_binary6414.9

    \[\leadsto \frac{\frac{0.25 - \color{blue}{\sqrt{{\left(\sqrt{\frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)}^{4}} \cdot \sqrt{{\left(\sqrt{\frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)}^{4}}}}{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}\]
  11. Applied add-sqr-sqrt_binary6414.9

    \[\leadsto \frac{\frac{\color{blue}{\sqrt{0.25} \cdot \sqrt{0.25}} - \sqrt{{\left(\sqrt{\frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)}^{4}} \cdot \sqrt{{\left(\sqrt{\frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)}^{4}}}{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}\]
  12. Applied difference-of-squares_binary6414.9

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

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

Alternatives

Reproduce

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