Average Error: 3.8 → 1.6
Time: 7.0s
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 \le -4.6829320224626613 \cdot 10^{144} \lor \neg \left(t \le 4.3847339126164306 \cdot 10^{71}\right):\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{3 \cdot \left(y \cdot \frac{z}{t}\right)}\\ \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}\;t \le -4.6829320224626613 \cdot 10^{144} \lor \neg \left(t \le 4.3847339126164306 \cdot 10^{71}\right):\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{3 \cdot \left(y \cdot \frac{z}{t}\right)}\\

\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 (((t <= -4.682932022462661e+144) || !(t <= 4.3847339126164306e+71))) {
		VAR = ((double) (((double) (x - ((double) (y / ((double) (z * 3.0)))))) + ((double) (1.0 / ((double) (3.0 * ((double) (y * ((double) (z / t))))))))));
	} 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.8
Target1.7
Herbie1.6
\[\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 < -4.6829320224626613e144 or 4.3847339126164306e71 < t

    1. Initial program 0.9

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

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

      \[\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 associate-/r/2.8

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

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

    if -4.6829320224626613e144 < t < 4.3847339126164306e71

    1. Initial program 4.8

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

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

      \[\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 simplification1.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -4.6829320224626613 \cdot 10^{144} \lor \neg \left(t \le 4.3847339126164306 \cdot 10^{71}\right):\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{3 \cdot \left(y \cdot \frac{z}{t}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y} \cdot \frac{0.333333333333333315}{z}\\ \end{array}\]

Reproduce

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