Average Error: 3.6 → 1.9
Time: 4.0s
Precision: 64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;x \le -9.05462723233705076 \cdot 10^{-165} \lor \neg \left(x \le 2.76883854637860401 \cdot 10^{-269}\right):\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{\frac{t}{z}}{3}}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{1}{z} \cdot \frac{y}{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}\;x \le -9.05462723233705076 \cdot 10^{-165} \lor \neg \left(x \le 2.76883854637860401 \cdot 10^{-269}\right):\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{\frac{t}{z}}{3}}{y}\\

\mathbf{else}:\\
\;\;\;\;\left(x - \frac{1}{z} \cdot \frac{y}{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 (((x <= -9.05462723233705e-165) || !(x <= 2.768838546378604e-269))) {
		VAR = ((double) (((double) (x - ((double) (y / ((double) (z * 3.0)))))) + ((double) (((double) (((double) (t / z)) / 3.0)) / y))));
	} else {
		VAR = ((double) (((double) (x - ((double) (((double) (1.0 / z)) * ((double) (y / 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.6
Target1.7
Herbie1.9
\[\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 < -9.05462723233705e-165 or 2.768838546378604e-269 < x

    1. Initial program 3.5

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

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

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

    if -9.05462723233705e-165 < x < 2.768838546378604e-269

    1. Initial program 4.1

      \[\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-identity4.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -9.05462723233705076 \cdot 10^{-165} \lor \neg \left(x \le 2.76883854637860401 \cdot 10^{-269}\right):\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{\frac{t}{z}}{3}}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{1}{z} \cdot \frac{y}{3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020140 
(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))))