Average Error: 3.5 → 0.6
Time: 11.4s
Precision: binary64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot 3 \le -1.19343762811851419 \cdot 10^{108}:\\ \;\;\;\;\left(x - \frac{1}{\frac{z \cdot 3}{y}}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \mathbf{elif}\;z \cdot 3 \le 2.139897000552487 \cdot 10^{43}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{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}\;z \cdot 3 \le -1.19343762811851419 \cdot 10^{108}:\\
\;\;\;\;\left(x - \frac{1}{\frac{z \cdot 3}{y}}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\

\mathbf{elif}\;z \cdot 3 \le 2.139897000552487 \cdot 10^{43}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{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 - (y / ((double) (z * 3.0))))) + (t / ((double) (((double) (z * 3.0)) * y)))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((((double) (z * 3.0)) <= -1.1934376281185142e+108)) {
		VAR = ((double) (((double) (x - (1.0 / (((double) (z * 3.0)) / y)))) + (t / ((double) (((double) (z * 3.0)) * y)))));
	} else {
		double VAR_1;
		if ((((double) (z * 3.0)) <= 2.139897000552487e+43)) {
			VAR_1 = ((double) (((double) (x - (y / ((double) (z * 3.0))))) + ((double) ((1.0 / ((double) (z * 3.0))) * (t / y)))));
		} else {
			VAR_1 = ((double) (((double) (x - ((double) (y * (1.0 / ((double) (z * 3.0))))))) + (t / ((double) (((double) (z * 3.0)) * y)))));
		}
		VAR = VAR_1;
	}
	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
Target2.0
Herbie0.6
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]

Derivation

  1. Split input into 3 regimes
  2. if (* z 3.0) < -1.19343762811851419e108

    1. Initial program 0.5

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

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

    if -1.19343762811851419e108 < (* z 3.0) < 2.139897000552487e43

    1. Initial program 6.8

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity6.8

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

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

    if 2.139897000552487e43 < (* z 3.0)

    1. Initial program 0.4

      \[\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.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot 3 \le -1.19343762811851419 \cdot 10^{108}:\\ \;\;\;\;\left(x - \frac{1}{\frac{z \cdot 3}{y}}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \mathbf{elif}\;z \cdot 3 \le 2.139897000552487 \cdot 10^{43}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{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 2020182 
(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))))