Average Error: 3.5 → 2.1
Time: 5.8s
Precision: binary64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.01746334205637897 \cdot 10^{-291} \lor \neg \left(x \le 1.400681836821822 \cdot 10^{37}\right):\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{\left(y \cdot \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right)\right) \cdot \frac{z}{\frac{t}{\sqrt[3]{3}}}}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y} \cdot \frac{0.333333333333333315}{z}\\ \end{array}\]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
\mathbf{if}\;x \le -2.01746334205637897 \cdot 10^{-291} \lor \neg \left(x \le 1.400681836821822 \cdot 10^{37}\right):\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{\left(y \cdot \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right)\right) \cdot \frac{z}{\frac{t}{\sqrt[3]{3}}}}\\

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

\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 (((x <= -2.017463342056379e-291) || !(x <= 1.4006818368218224e+37))) {
		VAR = ((double) (((double) (x - ((double) (y / ((double) (z * 3.0)))))) + ((double) (1.0 / ((double) (((double) (y * ((double) (((double) cbrt(3.0)) * ((double) cbrt(3.0)))))) * ((double) (z / ((double) (t / ((double) cbrt(3.0))))))))))));
	} else {
		VAR = ((double) (((double) (x - ((double) (y / ((double) (z * 3.0)))))) + ((double) (((double) (t / y)) * ((double) (0.3333333333333333 / z))))));
	}
	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
Herbie2.1
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -2.01746334205637897e-291 or 1.400681836821822e37 < x

    1. Initial program 3.3

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

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

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{y \cdot \frac{z}{\frac{t}{\color{blue}{\left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \sqrt[3]{3}}}}}\]
    7. Applied *-un-lft-identity1.3

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{y \cdot \frac{z}{\color{blue}{\frac{1}{\sqrt[3]{3} \cdot \sqrt[3]{3}} \cdot \frac{t}{\sqrt[3]{3}}}}}\]
    9. Applied *-un-lft-identity1.3

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

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

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

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

    if -2.01746334205637897e-291 < x < 1.400681836821822e37

    1. Initial program 4.0

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Taylor expanded around 0 4.1

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \color{blue}{0.333333333333333315 \cdot \frac{t}{z \cdot y}}\]
    3. Simplified3.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -2.01746334205637897 \cdot 10^{-291} \lor \neg \left(x \le 1.400681836821822 \cdot 10^{37}\right):\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{\left(y \cdot \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right)\right) \cdot \frac{z}{\frac{t}{\sqrt[3]{3}}}}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y} \cdot \frac{0.333333333333333315}{z}\\ \end{array}\]

Reproduce

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

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

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