Average Error: 7.8 → 0.0
Time: 44.7s
Precision: binary64
Cost: 512
\[\frac{x \cdot y}{y + 1}\]
\[\left(-x\right) \cdot \frac{y}{-1 - y}\]
\frac{x \cdot y}{y + 1}
\left(-x\right) \cdot \frac{y}{-1 - y}
(FPCore (x y) :precision binary64 (/ (* x y) (+ y 1.0)))
(FPCore (x y) :precision binary64 (* (- x) (/ y (- -1.0 y))))
double code(double x, double y) {
	return (x * y) / (y + 1.0);
}
double code(double x, double y) {
	return -x * (y / (-1.0 - y));
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.8
Target0.0
Herbie0.0
\[\begin{array}{l} \mathbf{if}\;y < -3693.8482788297247:\\ \;\;\;\;\frac{x}{y \cdot y} - \left(\frac{x}{y} - x\right)\\ \mathbf{elif}\;y < 6799310503.41891:\\ \;\;\;\;\frac{x \cdot y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y} - \left(\frac{x}{y} - x\right)\\ \end{array}\]
Alternative 1
Accuracy0.6
Cost1600
\[x \cdot \left(\sqrt[3]{\frac{-y}{-1 - y}} \cdot \left(\sqrt[3]{\frac{-y}{-1 - y}} \cdot \sqrt[3]{\frac{-y}{-1 - y}}\right)\right)\]
Alternative 2
Accuracy0.6
Cost1792
\[x \cdot \left(\frac{\sqrt[3]{-y} \cdot \sqrt[3]{-y}}{\sqrt[3]{-1 - y} \cdot \sqrt[3]{-1 - y}} \cdot \frac{\sqrt[3]{-y}}{\sqrt[3]{-1 - y}}\right)\]

Derivation

  1. Initial program 7.8

    \[\frac{x \cdot y}{y + 1}\]
  2. Using strategy rm
  3. Applied *-un-lft-identity_binary64_181517.8

    \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot \left(y + 1\right)}}\]
  4. Applied times-frac_binary64_181570.0

    \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{y + 1}}\]
  5. Simplified0.0

    \[\leadsto \color{blue}{x} \cdot \frac{y}{y + 1}\]
  6. Using strategy rm
  7. Applied pow1_binary64_182120.0

    \[\leadsto x \cdot \color{blue}{{\left(\frac{y}{y + 1}\right)}^{1}}\]
  8. Using strategy rm
  9. Applied frac-2neg_binary64_181620.0

    \[\leadsto x \cdot {\color{blue}{\left(\frac{-y}{-\left(y + 1\right)}\right)}}^{1}\]
  10. Simplified0.0

    \[\leadsto x \cdot {\left(\frac{-y}{\color{blue}{-1 - y}}\right)}^{1}\]
  11. Using strategy rm
  12. Applied *-un-lft-identity_binary64_181510.0

    \[\leadsto x \cdot {\left(\frac{-y}{\color{blue}{1 \cdot \left(-1 - y\right)}}\right)}^{1}\]
  13. Applied neg-mul-1_binary64_181470.0

    \[\leadsto x \cdot {\left(\frac{\color{blue}{-1 \cdot y}}{1 \cdot \left(-1 - y\right)}\right)}^{1}\]
  14. Applied times-frac_binary64_181570.0

    \[\leadsto x \cdot {\color{blue}{\left(\frac{-1}{1} \cdot \frac{y}{-1 - y}\right)}}^{1}\]
  15. Applied unpow-prod-down_binary64_182300.0

    \[\leadsto x \cdot \color{blue}{\left({\left(\frac{-1}{1}\right)}^{1} \cdot {\left(\frac{y}{-1 - y}\right)}^{1}\right)}\]
  16. Applied associate-*r*_binary64_180910.0

    \[\leadsto \color{blue}{\left(x \cdot {\left(\frac{-1}{1}\right)}^{1}\right) \cdot {\left(\frac{y}{-1 - y}\right)}^{1}}\]
  17. Simplified0.0

    \[\leadsto \color{blue}{\left(-x\right)} \cdot {\left(\frac{y}{-1 - y}\right)}^{1}\]
  18. Final simplification0.0

    \[\leadsto \left(-x\right) \cdot \frac{y}{-1 - y}\]

Reproduce

herbie shell --seed 2020322 
(FPCore (x y)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, B"
  :precision binary64

  :herbie-target
  (if (< y -3693.8482788297247) (- (/ x (* y y)) (- (/ x y) x)) (if (< y 6799310503.41891) (/ (* x y) (+ y 1.0)) (- (/ x (* y y)) (- (/ x y) x))))

  (/ (* x y) (+ y 1.0)))