Average Error: 3.8 → 0.4
Time: 3.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}\;t \leq -1.8595142289576375 \cdot 10^{-07} \lor \neg \left(t \leq 4.6861036274789447 \cdot 10^{+27}\right):\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{\frac{t}{y} - y}{z}}{3}\\ \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 \leq -1.8595142289576375 \cdot 10^{-07} \lor \neg \left(t \leq 4.6861036274789447 \cdot 10^{+27}\right):\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{\frac{t}{y} - y}{z}}{3}\\

\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 (((t <= -1.8595142289576375e-07) || !(t <= 4.6861036274789447e+27))) {
		VAR = ((double) (((double) (x - (y / ((double) (z * 3.0))))) + (t / ((double) (y * ((double) (z * 3.0)))))));
	} else {
		VAR = ((double) (x + ((((double) ((t / y) - y)) / z) / 3.0)));
	}
	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.8
Target1.8
Herbie0.4
\[\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.85951422895763749e-7 or 4.6861036274789447e27 < t

    1. Initial program 0.7

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

    if -1.85951422895763749e-7 < t < 4.6861036274789447e27

    1. Initial program 6.0

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Simplified0.3

      \[\leadsto \color{blue}{x + \frac{\frac{t}{y} - y}{z \cdot 3}}\]
    3. Using strategy rm
    4. Applied associate-/r*0.3

      \[\leadsto x + \color{blue}{\frac{\frac{\frac{t}{y} - y}{z}}{3}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.8595142289576375 \cdot 10^{-07} \lor \neg \left(t \leq 4.6861036274789447 \cdot 10^{+27}\right):\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{\frac{t}{y} - y}{z}}{3}\\ \end{array}\]

Reproduce

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