Average Error: 3.5 → 1.3
Time: 12.7s
Precision: 64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;t \le 1.2137440454064957 \cdot 10^{-38}:\\ \;\;\;\;\left(x - \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{z}{\sqrt[3]{1}} \cdot \frac{3}{y}}\right) + \frac{\frac{t}{z}}{3 \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - y \cdot \frac{1}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \end{array}\]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
\mathbf{if}\;t \le 1.2137440454064957 \cdot 10^{-38}:\\
\;\;\;\;\left(x - \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{z}{\sqrt[3]{1}} \cdot \frac{3}{y}}\right) + \frac{\frac{t}{z}}{3 \cdot y}\\

\mathbf{else}:\\
\;\;\;\;\left(x - y \cdot \frac{1}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\

\end{array}
double code(double x, double y, double z, double t) {
	return ((double) (((double) (x - ((double) (y / ((double) (z * 3.0)))))) + ((double) (t / ((double) (((double) (z * 3.0)) * y))))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((t <= 1.2137440454064957e-38)) {
		VAR = ((double) (((double) (x - ((double) (((double) (((double) cbrt(1.0)) * ((double) cbrt(1.0)))) / ((double) (((double) (z / ((double) cbrt(1.0)))) * ((double) (3.0 / y)))))))) + ((double) (((double) (t / z)) / ((double) (3.0 * y))))));
	} else {
		VAR = ((double) (((double) (x - ((double) (y * ((double) (1.0 / ((double) (z * 3.0)))))))) + ((double) (t / ((double) (((double) (z * 3.0)) * y))))));
	}
	return VAR;
}

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

Original3.5
Target1.8
Herbie1.3
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]

Derivation

  1. Split input into 2 regimes
  2. if t < 1.2137440454064957e-38

    1. Initial program 4.4

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Using strategy rm
    3. Applied associate-*l*4.4

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

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

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

      \[\leadsto \left(x - \color{blue}{\frac{1}{z} \cdot \frac{y}{3}}\right) + \frac{\frac{t}{z}}{3 \cdot y}\]
    8. Using strategy rm
    9. Applied clear-num1.6

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

      \[\leadsto \left(x - \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{z} \cdot \frac{1}{\frac{3}{y}}\right) + \frac{\frac{t}{z}}{3 \cdot y}\]
    11. Applied associate-/l*1.6

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

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

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

    if 1.2137440454064957e-38 < t

    1. Initial program 0.7

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Using strategy rm
    3. Applied div-inv0.7

      \[\leadsto \left(x - \color{blue}{y \cdot \frac{1}{z \cdot 3}}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le 1.2137440454064957 \cdot 10^{-38}:\\ \;\;\;\;\left(x - \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{z}{\sqrt[3]{1}} \cdot \frac{3}{y}}\right) + \frac{\frac{t}{z}}{3 \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - y \cdot \frac{1}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020114 
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, H"
  :precision binary64

  :herbie-target
  (+ (- x (/ y (* z 3))) (/ (/ t (* z 3)) y))

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