Average Error: 2.1 → 2.0
Time: 10.5min
Precision: binary64
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[\frac{z - t}{\frac{y}{x}} + t\]
\frac{x}{y} \cdot \left(z - t\right) + t
\frac{z - t}{\frac{y}{x}} + t
double code(double x, double y, double z, double t) {
	return ((double) (((double) ((x / y) * ((double) (z - t)))) + t));
}
double code(double x, double y, double z, double t) {
	return ((double) ((((double) (z - t)) / (y / x)) + t));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.1
Target2.5
Herbie2.0
\[\begin{array}{l} \mathbf{if}\;z \lt 2.7594565545626922 \cdot 10^{-282}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \mathbf{elif}\;z \lt 2.326994450874436 \cdot 10^{-110}:\\ \;\;\;\;x \cdot \frac{z - t}{y} + t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \end{array}\]

Derivation

  1. Initial program 2.1

    \[\frac{x}{y} \cdot \left(z - t\right) + t\]
  2. Using strategy rm
  3. Applied add-cube-cbrt2.6

    \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(\left(\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}\right) \cdot \sqrt[3]{z - t}\right)} + t\]
  4. Applied associate-*r*2.6

    \[\leadsto \color{blue}{\left(\frac{x}{y} \cdot \left(\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}\right)\right) \cdot \sqrt[3]{z - t}} + t\]
  5. Using strategy rm
  6. Applied pow12.6

    \[\leadsto \left(\frac{x}{y} \cdot \left(\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}\right)\right) \cdot \color{blue}{{\left(\sqrt[3]{z - t}\right)}^{1}} + t\]
  7. Applied pow12.6

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

    \[\leadsto \left(\frac{x}{y} \cdot \left(\color{blue}{{\left(\sqrt[3]{z - t}\right)}^{1}} \cdot {\left(\sqrt[3]{z - t}\right)}^{1}\right)\right) \cdot {\left(\sqrt[3]{z - t}\right)}^{1} + t\]
  9. Applied pow-prod-down2.6

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

    \[\leadsto \left(\color{blue}{{\left(\frac{x}{y}\right)}^{1}} \cdot {\left(\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}\right)}^{1}\right) \cdot {\left(\sqrt[3]{z - t}\right)}^{1} + t\]
  11. Applied pow-prod-down2.6

    \[\leadsto \color{blue}{{\left(\frac{x}{y} \cdot \left(\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}\right)\right)}^{1}} \cdot {\left(\sqrt[3]{z - t}\right)}^{1} + t\]
  12. Applied pow-prod-down2.6

    \[\leadsto \color{blue}{{\left(\left(\frac{x}{y} \cdot \left(\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}\right)\right) \cdot \sqrt[3]{z - t}\right)}^{1}} + t\]
  13. Simplified2.0

    \[\leadsto {\color{blue}{\left(\frac{z - t}{\frac{y}{x}}\right)}}^{1} + t\]
  14. Final simplification2.0

    \[\leadsto \frac{z - t}{\frac{y}{x}} + t\]

Reproduce

herbie shell --seed 2020181 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
  :precision binary64

  :herbie-target
  (if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))

  (+ (* (/ x y) (- z t)) t))