Average Error: 7.4 → 0.6
Time: 4.0s
Precision: binary64
\[\frac{x + y}{1 - \frac{y}{z}} \]
\[\begin{array}{l} t_0 := \sqrt[3]{y + x}\\ \frac{1}{\frac{1}{y + x} - \left(\frac{1}{z} \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{t_0 \cdot t_0}\right) \cdot \frac{\sqrt[3]{y}}{t_0}} \end{array} \]
\frac{x + y}{1 - \frac{y}{z}}
\begin{array}{l}
t_0 := \sqrt[3]{y + x}\\
\frac{1}{\frac{1}{y + x} - \left(\frac{1}{z} \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{t_0 \cdot t_0}\right) \cdot \frac{\sqrt[3]{y}}{t_0}}
\end{array}
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (cbrt (+ y x))))
   (/
    1.0
    (-
     (/ 1.0 (+ y x))
     (*
      (* (/ 1.0 z) (/ (* (cbrt y) (cbrt y)) (* t_0 t_0)))
      (/ (cbrt y) t_0))))))
double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
double code(double x, double y, double z) {
	double t_0 = cbrt(y + x);
	return 1.0 / ((1.0 / (y + x)) - (((1.0 / z) * ((cbrt(y) * cbrt(y)) / (t_0 * t_0))) * (cbrt(y) / t_0)));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.4
Target3.9
Herbie0.6
\[\begin{array}{l} \mathbf{if}\;y < -3.7429310762689856 \cdot 10^{+171}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \mathbf{elif}\;y < 3.5534662456086734 \cdot 10^{+168}:\\ \;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \end{array} \]

Derivation

  1. Initial program 7.4

    \[\frac{x + y}{1 - \frac{y}{z}} \]
  2. Applied clear-num_binary647.5

    \[\leadsto \color{blue}{\frac{1}{\frac{1 - \frac{y}{z}}{x + y}}} \]
  3. Taylor expanded in z around 0 6.6

    \[\leadsto \frac{1}{\color{blue}{\frac{1}{y + x} - \frac{y}{z \cdot \left(y + x\right)}}} \]
  4. Applied *-un-lft-identity_binary646.6

    \[\leadsto \frac{1}{\frac{1}{y + x} - \frac{\color{blue}{1 \cdot y}}{z \cdot \left(y + x\right)}} \]
  5. Applied times-frac_binary641.6

    \[\leadsto \frac{1}{\frac{1}{y + x} - \color{blue}{\frac{1}{z} \cdot \frac{y}{y + x}}} \]
  6. Applied add-cube-cbrt_binary642.1

    \[\leadsto \frac{1}{\frac{1}{y + x} - \frac{1}{z} \cdot \frac{y}{\color{blue}{\left(\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}\right) \cdot \sqrt[3]{y + x}}}} \]
  7. Applied add-cube-cbrt_binary641.8

    \[\leadsto \frac{1}{\frac{1}{y + x} - \frac{1}{z} \cdot \frac{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}{\left(\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}\right) \cdot \sqrt[3]{y + x}}} \]
  8. Applied times-frac_binary641.8

    \[\leadsto \frac{1}{\frac{1}{y + x} - \frac{1}{z} \cdot \color{blue}{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}} \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{y + x}}\right)}} \]
  9. Applied associate-*r*_binary640.6

    \[\leadsto \frac{1}{\frac{1}{y + x} - \color{blue}{\left(\frac{1}{z} \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}}\right) \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{y + x}}}} \]
  10. Final simplification0.6

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

Reproduce

herbie shell --seed 2021313 
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
  :precision binary64

  :herbie-target
  (if (< y -3.7429310762689856e+171) (* (/ (+ y x) (- y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) (* (/ (+ y x) (- y)) z)))

  (/ (+ x y) (- 1.0 (/ y z))))