Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H

Percentage Accurate: 95.4% → 95.4%
Time: 8.2s
Alternatives: 10
Speedup: 1.4×

Specification

?
\[\begin{array}{l} \\ \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t):
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t)
	return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y)))
end
function tmp = code(x, y, z, t)
	tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 95.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t):
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t)
	return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y)))
end
function tmp = code(x, y, z, t)
	tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 95.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \frac{\frac{y}{z}}{-3} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (+ (/ t (* z (* y 3.0))) x) (/ (/ y z) -3.0)))
double code(double x, double y, double z, double t) {
	return ((t / (z * (y * 3.0))) + x) + ((y / z) / -3.0);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((t / (z * (y * 3.0d0))) + x) + ((y / z) / (-3.0d0))
end function
public static double code(double x, double y, double z, double t) {
	return ((t / (z * (y * 3.0))) + x) + ((y / z) / -3.0);
}
def code(x, y, z, t):
	return ((t / (z * (y * 3.0))) + x) + ((y / z) / -3.0)
function code(x, y, z, t)
	return Float64(Float64(Float64(t / Float64(z * Float64(y * 3.0))) + x) + Float64(Float64(y / z) / -3.0))
end
function tmp = code(x, y, z, t)
	tmp = ((t / (z * (y * 3.0))) + x) + ((y / z) / -3.0);
end
code[x_, y_, z_, t_] := N[(N[(N[(t / N[(z * N[(y * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] + N[(N[(y / z), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \frac{\frac{y}{z}}{-3}
\end{array}
Derivation
  1. Initial program 97.5%

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
  2. Step-by-step derivation
    1. +-commutative97.5%

      \[\leadsto \color{blue}{\frac{t}{\left(z \cdot 3\right) \cdot y} + \left(x - \frac{y}{z \cdot 3}\right)} \]
    2. associate-+r-97.5%

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

      \[\leadsto \color{blue}{\left(\frac{t}{\left(z \cdot 3\right) \cdot y} + x\right) + \left(-\frac{y}{z \cdot 3}\right)} \]
    4. associate-*l*97.6%

      \[\leadsto \left(\frac{t}{\color{blue}{z \cdot \left(3 \cdot y\right)}} + x\right) + \left(-\frac{y}{z \cdot 3}\right) \]
    5. *-commutative97.6%

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

      \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \color{blue}{\frac{y}{-z \cdot 3}} \]
    7. distribute-rgt-neg-in97.6%

      \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \frac{y}{\color{blue}{z \cdot \left(-3\right)}} \]
    8. metadata-eval97.6%

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

    \[\leadsto \color{blue}{\left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \frac{y}{z \cdot -3}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-/r*97.6%

      \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \color{blue}{\frac{\frac{y}{z}}{-3}} \]
    2. add-cube-cbrt97.2%

      \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \frac{\color{blue}{\left(\sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{\frac{y}{z}}\right) \cdot \sqrt[3]{\frac{y}{z}}}}{-3} \]
    3. associate-/l*97.2%

      \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \color{blue}{\left(\sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{\frac{y}{z}}\right) \cdot \frac{\sqrt[3]{\frac{y}{z}}}{-3}} \]
    4. pow297.2%

      \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \color{blue}{{\left(\sqrt[3]{\frac{y}{z}}\right)}^{2}} \cdot \frac{\sqrt[3]{\frac{y}{z}}}{-3} \]
  6. Applied egg-rr97.2%

    \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \color{blue}{{\left(\sqrt[3]{\frac{y}{z}}\right)}^{2} \cdot \frac{\sqrt[3]{\frac{y}{z}}}{-3}} \]
  7. Step-by-step derivation
    1. associate-*r/97.2%

      \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \color{blue}{\frac{{\left(\sqrt[3]{\frac{y}{z}}\right)}^{2} \cdot \sqrt[3]{\frac{y}{z}}}{-3}} \]
    2. unpow297.2%

      \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \frac{\color{blue}{\left(\sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{\frac{y}{z}}\right)} \cdot \sqrt[3]{\frac{y}{z}}}{-3} \]
    3. rem-3cbrt-lft97.6%

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

    \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \color{blue}{\frac{\frac{y}{z}}{-3}} \]
  9. Final simplification97.6%

    \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \frac{\frac{y}{z}}{-3} \]
  10. Add Preprocessing

Alternative 2: 88.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6 \cdot 10^{-8} \lor \neg \left(y \leq 7 \cdot 10^{-59}\right):\\ \;\;\;\;x + \frac{\frac{y}{z}}{-3}\\ \mathbf{else}:\\ \;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{z \cdot y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -6e-8) (not (<= y 7e-59)))
   (+ x (/ (/ y z) -3.0))
   (+ x (* 0.3333333333333333 (/ t (* z y))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -6e-8) || !(y <= 7e-59)) {
		tmp = x + ((y / z) / -3.0);
	} else {
		tmp = x + (0.3333333333333333 * (t / (z * y)));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((y <= (-6d-8)) .or. (.not. (y <= 7d-59))) then
        tmp = x + ((y / z) / (-3.0d0))
    else
        tmp = x + (0.3333333333333333d0 * (t / (z * y)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -6e-8) || !(y <= 7e-59)) {
		tmp = x + ((y / z) / -3.0);
	} else {
		tmp = x + (0.3333333333333333 * (t / (z * y)));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= -6e-8) or not (y <= 7e-59):
		tmp = x + ((y / z) / -3.0)
	else:
		tmp = x + (0.3333333333333333 * (t / (z * y)))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -6e-8) || !(y <= 7e-59))
		tmp = Float64(x + Float64(Float64(y / z) / -3.0));
	else
		tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(z * y))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y <= -6e-8) || ~((y <= 7e-59)))
		tmp = x + ((y / z) / -3.0);
	else
		tmp = x + (0.3333333333333333 * (t / (z * y)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6e-8], N[Not[LessEqual[y, 7e-59]], $MachinePrecision]], N[(x + N[(N[(y / z), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(0.3333333333333333 * N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{-8} \lor \neg \left(y \leq 7 \cdot 10^{-59}\right):\\
\;\;\;\;x + \frac{\frac{y}{z}}{-3}\\

\mathbf{else}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{z \cdot y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.99999999999999946e-8 or 7.0000000000000002e-59 < y

    1. Initial program 99.9%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

        \[\leadsto \color{blue}{\left(x + \left(-\frac{y}{z \cdot 3}\right)\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      2. associate-+l+99.9%

        \[\leadsto \color{blue}{x + \left(\left(-\frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      3. remove-double-neg99.9%

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \color{blue}{\left(-\left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)}\right) \]
      4. distribute-frac-neg99.9%

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \left(-\color{blue}{\frac{-t}{\left(z \cdot 3\right) \cdot y}}\right)\right) \]
      5. sub-neg99.9%

        \[\leadsto x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      6. distribute-frac-neg99.9%

        \[\leadsto x + \left(\color{blue}{\frac{-y}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      7. neg-mul-199.9%

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

        \[\leadsto x + \left(\frac{\color{blue}{y \cdot -1}}{z \cdot 3} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      9. associate-/l*99.8%

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

        \[\leadsto x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      11. neg-mul-199.8%

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

        \[\leadsto x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]
      13. distribute-lft-out--99.8%

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

        \[\leadsto x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]
      15. associate-/r*99.7%

        \[\leadsto x + \color{blue}{\frac{\frac{-1}{3}}{z}} \cdot \left(y - \frac{t}{y}\right) \]
      16. metadata-eval99.7%

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

      \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 94.5%

      \[\leadsto x + \color{blue}{-0.3333333333333333 \cdot \frac{y}{z}} \]
    6. Step-by-step derivation
      1. *-commutative94.5%

        \[\leadsto x + \color{blue}{\frac{y}{z} \cdot -0.3333333333333333} \]
      2. metadata-eval94.5%

        \[\leadsto x + \frac{y}{z} \cdot \color{blue}{\frac{1}{-3}} \]
      3. div-inv94.6%

        \[\leadsto x + \color{blue}{\frac{\frac{y}{z}}{-3}} \]
    7. Applied egg-rr94.6%

      \[\leadsto x + \color{blue}{\frac{\frac{y}{z}}{-3}} \]

    if -5.99999999999999946e-8 < y < 7.0000000000000002e-59

    1. Initial program 94.9%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. sub-neg94.9%

        \[\leadsto \color{blue}{\left(x + \left(-\frac{y}{z \cdot 3}\right)\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      2. associate-+l+94.9%

        \[\leadsto \color{blue}{x + \left(\left(-\frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      3. remove-double-neg94.9%

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \color{blue}{\left(-\left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)}\right) \]
      4. distribute-frac-neg94.9%

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \left(-\color{blue}{\frac{-t}{\left(z \cdot 3\right) \cdot y}}\right)\right) \]
      5. sub-neg94.9%

        \[\leadsto x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      6. distribute-frac-neg94.9%

        \[\leadsto x + \left(\color{blue}{\frac{-y}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      7. neg-mul-194.9%

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

        \[\leadsto x + \left(\frac{\color{blue}{y \cdot -1}}{z \cdot 3} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      9. associate-/l*94.9%

        \[\leadsto x + \left(\color{blue}{y \cdot \frac{-1}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      10. *-commutative94.9%

        \[\leadsto x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      11. neg-mul-194.9%

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

        \[\leadsto x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]
      13. distribute-lft-out--92.2%

        \[\leadsto x + \color{blue}{\frac{-1}{z \cdot 3} \cdot \left(y - \frac{t}{y}\right)} \]
      14. *-commutative92.2%

        \[\leadsto x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]
      15. associate-/r*92.2%

        \[\leadsto x + \color{blue}{\frac{\frac{-1}{3}}{z}} \cdot \left(y - \frac{t}{y}\right) \]
      16. metadata-eval92.2%

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

      \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 94.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6 \cdot 10^{-8} \lor \neg \left(y \leq 7 \cdot 10^{-59}\right):\\ \;\;\;\;x + \frac{\frac{y}{z}}{-3}\\ \mathbf{else}:\\ \;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{z \cdot y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 91.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.000145 \lor \neg \left(y \leq 7 \cdot 10^{-59}\right):\\ \;\;\;\;x + \frac{\frac{y}{z}}{-3}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{0.3333333333333333}{y \cdot \frac{z}{t}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -0.000145) (not (<= y 7e-59)))
   (+ x (/ (/ y z) -3.0))
   (+ x (/ 0.3333333333333333 (* y (/ z t))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -0.000145) || !(y <= 7e-59)) {
		tmp = x + ((y / z) / -3.0);
	} else {
		tmp = x + (0.3333333333333333 / (y * (z / t)));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((y <= (-0.000145d0)) .or. (.not. (y <= 7d-59))) then
        tmp = x + ((y / z) / (-3.0d0))
    else
        tmp = x + (0.3333333333333333d0 / (y * (z / t)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -0.000145) || !(y <= 7e-59)) {
		tmp = x + ((y / z) / -3.0);
	} else {
		tmp = x + (0.3333333333333333 / (y * (z / t)));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= -0.000145) or not (y <= 7e-59):
		tmp = x + ((y / z) / -3.0)
	else:
		tmp = x + (0.3333333333333333 / (y * (z / t)))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -0.000145) || !(y <= 7e-59))
		tmp = Float64(x + Float64(Float64(y / z) / -3.0));
	else
		tmp = Float64(x + Float64(0.3333333333333333 / Float64(y * Float64(z / t))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y <= -0.000145) || ~((y <= 7e-59)))
		tmp = x + ((y / z) / -3.0);
	else
		tmp = x + (0.3333333333333333 / (y * (z / t)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -0.000145], N[Not[LessEqual[y, 7e-59]], $MachinePrecision]], N[(x + N[(N[(y / z), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(0.3333333333333333 / N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.000145 \lor \neg \left(y \leq 7 \cdot 10^{-59}\right):\\
\;\;\;\;x + \frac{\frac{y}{z}}{-3}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{0.3333333333333333}{y \cdot \frac{z}{t}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.45e-4 or 7.0000000000000002e-59 < y

    1. Initial program 99.9%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

        \[\leadsto \color{blue}{\left(x + \left(-\frac{y}{z \cdot 3}\right)\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      2. associate-+l+99.9%

        \[\leadsto \color{blue}{x + \left(\left(-\frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      3. remove-double-neg99.9%

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \color{blue}{\left(-\left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)}\right) \]
      4. distribute-frac-neg99.9%

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \left(-\color{blue}{\frac{-t}{\left(z \cdot 3\right) \cdot y}}\right)\right) \]
      5. sub-neg99.9%

        \[\leadsto x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      6. distribute-frac-neg99.9%

        \[\leadsto x + \left(\color{blue}{\frac{-y}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      7. neg-mul-199.9%

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

        \[\leadsto x + \left(\frac{\color{blue}{y \cdot -1}}{z \cdot 3} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      9. associate-/l*99.8%

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

        \[\leadsto x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      11. neg-mul-199.8%

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

        \[\leadsto x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]
      13. distribute-lft-out--99.8%

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

        \[\leadsto x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]
      15. associate-/r*99.7%

        \[\leadsto x + \color{blue}{\frac{\frac{-1}{3}}{z}} \cdot \left(y - \frac{t}{y}\right) \]
      16. metadata-eval99.7%

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

      \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 94.5%

      \[\leadsto x + \color{blue}{-0.3333333333333333 \cdot \frac{y}{z}} \]
    6. Step-by-step derivation
      1. *-commutative94.5%

        \[\leadsto x + \color{blue}{\frac{y}{z} \cdot -0.3333333333333333} \]
      2. metadata-eval94.5%

        \[\leadsto x + \frac{y}{z} \cdot \color{blue}{\frac{1}{-3}} \]
      3. div-inv94.6%

        \[\leadsto x + \color{blue}{\frac{\frac{y}{z}}{-3}} \]
    7. Applied egg-rr94.6%

      \[\leadsto x + \color{blue}{\frac{\frac{y}{z}}{-3}} \]

    if -1.45e-4 < y < 7.0000000000000002e-59

    1. Initial program 94.9%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. sub-neg94.9%

        \[\leadsto \color{blue}{\left(x + \left(-\frac{y}{z \cdot 3}\right)\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      2. associate-+l+94.9%

        \[\leadsto \color{blue}{x + \left(\left(-\frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      3. remove-double-neg94.9%

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \color{blue}{\left(-\left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)}\right) \]
      4. distribute-frac-neg94.9%

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \left(-\color{blue}{\frac{-t}{\left(z \cdot 3\right) \cdot y}}\right)\right) \]
      5. sub-neg94.9%

        \[\leadsto x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      6. distribute-frac-neg94.9%

        \[\leadsto x + \left(\color{blue}{\frac{-y}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      7. neg-mul-194.9%

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

        \[\leadsto x + \left(\frac{\color{blue}{y \cdot -1}}{z \cdot 3} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      9. associate-/l*94.9%

        \[\leadsto x + \left(\color{blue}{y \cdot \frac{-1}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      10. *-commutative94.9%

        \[\leadsto x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      11. neg-mul-194.9%

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

        \[\leadsto x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]
      13. distribute-lft-out--92.2%

        \[\leadsto x + \color{blue}{\frac{-1}{z \cdot 3} \cdot \left(y - \frac{t}{y}\right)} \]
      14. *-commutative92.2%

        \[\leadsto x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]
      15. associate-/r*92.2%

        \[\leadsto x + \color{blue}{\frac{\frac{-1}{3}}{z}} \cdot \left(y - \frac{t}{y}\right) \]
      16. metadata-eval92.2%

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

      \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 94.2%

      \[\leadsto x + \color{blue}{0.3333333333333333 \cdot \frac{t}{y \cdot z}} \]
    6. Step-by-step derivation
      1. clear-num94.1%

        \[\leadsto x + 0.3333333333333333 \cdot \color{blue}{\frac{1}{\frac{y \cdot z}{t}}} \]
      2. un-div-inv94.8%

        \[\leadsto x + \color{blue}{\frac{0.3333333333333333}{\frac{y \cdot z}{t}}} \]
      3. associate-/l*95.3%

        \[\leadsto x + \frac{0.3333333333333333}{\color{blue}{y \cdot \frac{z}{t}}} \]
    7. Applied egg-rr95.3%

      \[\leadsto x + \color{blue}{\frac{0.3333333333333333}{y \cdot \frac{z}{t}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.000145 \lor \neg \left(y \leq 7 \cdot 10^{-59}\right):\\ \;\;\;\;x + \frac{\frac{y}{z}}{-3}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{0.3333333333333333}{y \cdot \frac{z}{t}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 48.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.2 \cdot 10^{+49}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 8 \cdot 10^{+34}:\\ \;\;\;\;\frac{y}{z} \cdot -0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= x -4.2e+49) x (if (<= x 8e+34) (* (/ y z) -0.3333333333333333) x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -4.2e+49) {
		tmp = x;
	} else if (x <= 8e+34) {
		tmp = (y / z) * -0.3333333333333333;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x <= (-4.2d+49)) then
        tmp = x
    else if (x <= 8d+34) then
        tmp = (y / z) * (-0.3333333333333333d0)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -4.2e+49) {
		tmp = x;
	} else if (x <= 8e+34) {
		tmp = (y / z) * -0.3333333333333333;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= -4.2e+49:
		tmp = x
	elif x <= 8e+34:
		tmp = (y / z) * -0.3333333333333333
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x <= -4.2e+49)
		tmp = x;
	elseif (x <= 8e+34)
		tmp = Float64(Float64(y / z) * -0.3333333333333333);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= -4.2e+49)
		tmp = x;
	elseif (x <= 8e+34)
		tmp = (y / z) * -0.3333333333333333;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.2e+49], x, If[LessEqual[x, 8e+34], N[(N[(y / z), $MachinePrecision] * -0.3333333333333333), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+49}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 8 \cdot 10^{+34}:\\
\;\;\;\;\frac{y}{z} \cdot -0.3333333333333333\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.20000000000000022e49 or 7.99999999999999956e34 < x

    1. Initial program 97.2%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. sub-neg97.2%

        \[\leadsto \color{blue}{\left(x + \left(-\frac{y}{z \cdot 3}\right)\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      2. associate-+l+97.2%

        \[\leadsto \color{blue}{x + \left(\left(-\frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      3. remove-double-neg97.2%

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \color{blue}{\left(-\left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)}\right) \]
      4. distribute-frac-neg97.2%

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \left(-\color{blue}{\frac{-t}{\left(z \cdot 3\right) \cdot y}}\right)\right) \]
      5. sub-neg97.2%

        \[\leadsto x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      6. distribute-frac-neg97.2%

        \[\leadsto x + \left(\color{blue}{\frac{-y}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      7. neg-mul-197.2%

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

        \[\leadsto x + \left(\frac{\color{blue}{y \cdot -1}}{z \cdot 3} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      9. associate-/l*97.2%

        \[\leadsto x + \left(\color{blue}{y \cdot \frac{-1}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      10. *-commutative97.2%

        \[\leadsto x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      11. neg-mul-197.2%

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

        \[\leadsto x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]
      13. distribute-lft-out--96.0%

        \[\leadsto x + \color{blue}{\frac{-1}{z \cdot 3} \cdot \left(y - \frac{t}{y}\right)} \]
      14. *-commutative96.0%

        \[\leadsto x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]
      15. associate-/r*95.9%

        \[\leadsto x + \color{blue}{\frac{\frac{-1}{3}}{z}} \cdot \left(y - \frac{t}{y}\right) \]
      16. metadata-eval95.9%

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

      \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 73.5%

      \[\leadsto x + \color{blue}{-0.3333333333333333 \cdot \frac{y}{z}} \]
    6. Taylor expanded in x around inf 56.6%

      \[\leadsto \color{blue}{x} \]

    if -4.20000000000000022e49 < x < 7.99999999999999956e34

    1. Initial program 97.8%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. sub-neg97.8%

        \[\leadsto \color{blue}{\left(x + \left(-\frac{y}{z \cdot 3}\right)\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      2. associate-+l+97.8%

        \[\leadsto \color{blue}{x + \left(\left(-\frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      3. remove-double-neg97.8%

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

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \left(-\color{blue}{\frac{-t}{\left(z \cdot 3\right) \cdot y}}\right)\right) \]
      5. sub-neg97.8%

        \[\leadsto x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      6. distribute-frac-neg97.8%

        \[\leadsto x + \left(\color{blue}{\frac{-y}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      7. neg-mul-197.8%

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

        \[\leadsto x + \left(\frac{\color{blue}{y \cdot -1}}{z \cdot 3} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      9. associate-/l*97.7%

        \[\leadsto x + \left(\color{blue}{y \cdot \frac{-1}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      10. *-commutative97.7%

        \[\leadsto x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      11. neg-mul-197.7%

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

        \[\leadsto x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]
      13. distribute-lft-out--96.5%

        \[\leadsto x + \color{blue}{\frac{-1}{z \cdot 3} \cdot \left(y - \frac{t}{y}\right)} \]
      14. *-commutative96.5%

        \[\leadsto x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]
      15. associate-/r*96.4%

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

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

      \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 58.0%

      \[\leadsto x + \color{blue}{-0.3333333333333333 \cdot \frac{y}{z}} \]
    6. Step-by-step derivation
      1. *-commutative58.0%

        \[\leadsto x + \color{blue}{\frac{y}{z} \cdot -0.3333333333333333} \]
      2. metadata-eval58.0%

        \[\leadsto x + \frac{y}{z} \cdot \color{blue}{\frac{1}{-3}} \]
      3. div-inv58.0%

        \[\leadsto x + \color{blue}{\frac{\frac{y}{z}}{-3}} \]
    7. Applied egg-rr58.0%

      \[\leadsto x + \color{blue}{\frac{\frac{y}{z}}{-3}} \]
    8. Taylor expanded in x around 0 49.1%

      \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{y}{z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification52.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.2 \cdot 10^{+49}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 8 \cdot 10^{+34}:\\ \;\;\;\;\frac{y}{z} \cdot -0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 48.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+50}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{+34}:\\ \;\;\;\;\frac{\frac{y}{z}}{-3}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= x -1.4e+50) x (if (<= x 6.8e+34) (/ (/ y z) -3.0) x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -1.4e+50) {
		tmp = x;
	} else if (x <= 6.8e+34) {
		tmp = (y / z) / -3.0;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x <= (-1.4d+50)) then
        tmp = x
    else if (x <= 6.8d+34) then
        tmp = (y / z) / (-3.0d0)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -1.4e+50) {
		tmp = x;
	} else if (x <= 6.8e+34) {
		tmp = (y / z) / -3.0;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= -1.4e+50:
		tmp = x
	elif x <= 6.8e+34:
		tmp = (y / z) / -3.0
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x <= -1.4e+50)
		tmp = x;
	elseif (x <= 6.8e+34)
		tmp = Float64(Float64(y / z) / -3.0);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= -1.4e+50)
		tmp = x;
	elseif (x <= 6.8e+34)
		tmp = (y / z) / -3.0;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.4e+50], x, If[LessEqual[x, 6.8e+34], N[(N[(y / z), $MachinePrecision] / -3.0), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+50}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 6.8 \cdot 10^{+34}:\\
\;\;\;\;\frac{\frac{y}{z}}{-3}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.3999999999999999e50 or 6.7999999999999999e34 < x

    1. Initial program 97.2%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. sub-neg97.2%

        \[\leadsto \color{blue}{\left(x + \left(-\frac{y}{z \cdot 3}\right)\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      2. associate-+l+97.2%

        \[\leadsto \color{blue}{x + \left(\left(-\frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      3. remove-double-neg97.2%

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \color{blue}{\left(-\left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)}\right) \]
      4. distribute-frac-neg97.2%

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \left(-\color{blue}{\frac{-t}{\left(z \cdot 3\right) \cdot y}}\right)\right) \]
      5. sub-neg97.2%

        \[\leadsto x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      6. distribute-frac-neg97.2%

        \[\leadsto x + \left(\color{blue}{\frac{-y}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      7. neg-mul-197.2%

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

        \[\leadsto x + \left(\frac{\color{blue}{y \cdot -1}}{z \cdot 3} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      9. associate-/l*97.2%

        \[\leadsto x + \left(\color{blue}{y \cdot \frac{-1}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      10. *-commutative97.2%

        \[\leadsto x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      11. neg-mul-197.2%

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

        \[\leadsto x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]
      13. distribute-lft-out--96.0%

        \[\leadsto x + \color{blue}{\frac{-1}{z \cdot 3} \cdot \left(y - \frac{t}{y}\right)} \]
      14. *-commutative96.0%

        \[\leadsto x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]
      15. associate-/r*95.9%

        \[\leadsto x + \color{blue}{\frac{\frac{-1}{3}}{z}} \cdot \left(y - \frac{t}{y}\right) \]
      16. metadata-eval95.9%

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

      \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 73.5%

      \[\leadsto x + \color{blue}{-0.3333333333333333 \cdot \frac{y}{z}} \]
    6. Taylor expanded in x around inf 56.6%

      \[\leadsto \color{blue}{x} \]

    if -1.3999999999999999e50 < x < 6.7999999999999999e34

    1. Initial program 97.8%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Step-by-step derivation
      1. sub-neg97.8%

        \[\leadsto \color{blue}{\left(x + \left(-\frac{y}{z \cdot 3}\right)\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
      2. associate-+l+97.8%

        \[\leadsto \color{blue}{x + \left(\left(-\frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      3. remove-double-neg97.8%

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

        \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \left(-\color{blue}{\frac{-t}{\left(z \cdot 3\right) \cdot y}}\right)\right) \]
      5. sub-neg97.8%

        \[\leadsto x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right)} \]
      6. distribute-frac-neg97.8%

        \[\leadsto x + \left(\color{blue}{\frac{-y}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      7. neg-mul-197.8%

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

        \[\leadsto x + \left(\frac{\color{blue}{y \cdot -1}}{z \cdot 3} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      9. associate-/l*97.7%

        \[\leadsto x + \left(\color{blue}{y \cdot \frac{-1}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      10. *-commutative97.7%

        \[\leadsto x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
      11. neg-mul-197.7%

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

        \[\leadsto x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]
      13. distribute-lft-out--96.5%

        \[\leadsto x + \color{blue}{\frac{-1}{z \cdot 3} \cdot \left(y - \frac{t}{y}\right)} \]
      14. *-commutative96.5%

        \[\leadsto x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]
      15. associate-/r*96.4%

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

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

      \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 58.0%

      \[\leadsto x + \color{blue}{-0.3333333333333333 \cdot \frac{y}{z}} \]
    6. Step-by-step derivation
      1. *-commutative58.0%

        \[\leadsto x + \color{blue}{\frac{y}{z} \cdot -0.3333333333333333} \]
      2. metadata-eval58.0%

        \[\leadsto x + \frac{y}{z} \cdot \color{blue}{\frac{1}{-3}} \]
      3. div-inv58.0%

        \[\leadsto x + \color{blue}{\frac{\frac{y}{z}}{-3}} \]
    7. Applied egg-rr58.0%

      \[\leadsto x + \color{blue}{\frac{\frac{y}{z}}{-3}} \]
    8. Taylor expanded in x around 0 49.1%

      \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{y}{z}} \]
    9. Step-by-step derivation
      1. *-commutative49.1%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot -0.3333333333333333} \]
      2. associate-*l/49.0%

        \[\leadsto \color{blue}{\frac{y \cdot -0.3333333333333333}{z}} \]
      3. associate-/l*49.0%

        \[\leadsto \color{blue}{y \cdot \frac{-0.3333333333333333}{z}} \]
    10. Simplified49.0%

      \[\leadsto \color{blue}{y \cdot \frac{-0.3333333333333333}{z}} \]
    11. Step-by-step derivation
      1. metadata-eval49.0%

        \[\leadsto y \cdot \frac{\color{blue}{\frac{1}{-3}}}{z} \]
      2. associate-/r*49.1%

        \[\leadsto y \cdot \color{blue}{\frac{1}{-3 \cdot z}} \]
      3. *-commutative49.1%

        \[\leadsto y \cdot \frac{1}{\color{blue}{z \cdot -3}} \]
      4. div-inv49.1%

        \[\leadsto \color{blue}{\frac{y}{z \cdot -3}} \]
      5. associate-/r*49.2%

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{-3}} \]
    12. Applied egg-rr49.2%

      \[\leadsto \color{blue}{\frac{\frac{y}{z}}{-3}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification52.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+50}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{+34}:\\ \;\;\;\;\frac{\frac{y}{z}}{-3}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 95.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \frac{y}{z \cdot -3} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (+ (/ t (* z (* y 3.0))) x) (/ y (* z -3.0))))
double code(double x, double y, double z, double t) {
	return ((t / (z * (y * 3.0))) + x) + (y / (z * -3.0));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((t / (z * (y * 3.0d0))) + x) + (y / (z * (-3.0d0)))
end function
public static double code(double x, double y, double z, double t) {
	return ((t / (z * (y * 3.0))) + x) + (y / (z * -3.0));
}
def code(x, y, z, t):
	return ((t / (z * (y * 3.0))) + x) + (y / (z * -3.0))
function code(x, y, z, t)
	return Float64(Float64(Float64(t / Float64(z * Float64(y * 3.0))) + x) + Float64(y / Float64(z * -3.0)))
end
function tmp = code(x, y, z, t)
	tmp = ((t / (z * (y * 3.0))) + x) + (y / (z * -3.0));
end
code[x_, y_, z_, t_] := N[(N[(N[(t / N[(z * N[(y * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \frac{y}{z \cdot -3}
\end{array}
Derivation
  1. Initial program 97.5%

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
  2. Step-by-step derivation
    1. +-commutative97.5%

      \[\leadsto \color{blue}{\frac{t}{\left(z \cdot 3\right) \cdot y} + \left(x - \frac{y}{z \cdot 3}\right)} \]
    2. associate-+r-97.5%

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

      \[\leadsto \color{blue}{\left(\frac{t}{\left(z \cdot 3\right) \cdot y} + x\right) + \left(-\frac{y}{z \cdot 3}\right)} \]
    4. associate-*l*97.6%

      \[\leadsto \left(\frac{t}{\color{blue}{z \cdot \left(3 \cdot y\right)}} + x\right) + \left(-\frac{y}{z \cdot 3}\right) \]
    5. *-commutative97.6%

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

      \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \color{blue}{\frac{y}{-z \cdot 3}} \]
    7. distribute-rgt-neg-in97.6%

      \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \frac{y}{\color{blue}{z \cdot \left(-3\right)}} \]
    8. metadata-eval97.6%

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

    \[\leadsto \color{blue}{\left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \frac{y}{z \cdot -3}} \]
  4. Add Preprocessing
  5. Final simplification97.6%

    \[\leadsto \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \frac{y}{z \cdot -3} \]
  6. Add Preprocessing

Alternative 7: 95.8% accurate, 1.4× speedup?

\[\begin{array}{l} \\ x + -0.3333333333333333 \cdot \frac{y - \frac{t}{y}}{z} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ x (* -0.3333333333333333 (/ (- y (/ t y)) z))))
double code(double x, double y, double z, double t) {
	return x + (-0.3333333333333333 * ((y - (t / y)) / z));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x + ((-0.3333333333333333d0) * ((y - (t / y)) / z))
end function
public static double code(double x, double y, double z, double t) {
	return x + (-0.3333333333333333 * ((y - (t / y)) / z));
}
def code(x, y, z, t):
	return x + (-0.3333333333333333 * ((y - (t / y)) / z))
function code(x, y, z, t)
	return Float64(x + Float64(-0.3333333333333333 * Float64(Float64(y - Float64(t / y)) / z)))
end
function tmp = code(x, y, z, t)
	tmp = x + (-0.3333333333333333 * ((y - (t / y)) / z));
end
code[x_, y_, z_, t_] := N[(x + N[(-0.3333333333333333 * N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + -0.3333333333333333 \cdot \frac{y - \frac{t}{y}}{z}
\end{array}
Derivation
  1. Initial program 97.5%

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
  2. Step-by-step derivation
    1. sub-neg97.5%

      \[\leadsto \color{blue}{\left(x + \left(-\frac{y}{z \cdot 3}\right)\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. associate-+l+97.5%

      \[\leadsto \color{blue}{x + \left(\left(-\frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
    3. remove-double-neg97.5%

      \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \color{blue}{\left(-\left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)}\right) \]
    4. distribute-frac-neg97.5%

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

      \[\leadsto x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right)} \]
    6. distribute-frac-neg97.5%

      \[\leadsto x + \left(\color{blue}{\frac{-y}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    7. neg-mul-197.5%

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

      \[\leadsto x + \left(\frac{\color{blue}{y \cdot -1}}{z \cdot 3} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    9. associate-/l*97.5%

      \[\leadsto x + \left(\color{blue}{y \cdot \frac{-1}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    10. *-commutative97.5%

      \[\leadsto x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    11. neg-mul-197.5%

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

      \[\leadsto x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]
    13. distribute-lft-out--96.2%

      \[\leadsto x + \color{blue}{\frac{-1}{z \cdot 3} \cdot \left(y - \frac{t}{y}\right)} \]
    14. *-commutative96.2%

      \[\leadsto x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]
    15. associate-/r*96.2%

      \[\leadsto x + \color{blue}{\frac{\frac{-1}{3}}{z}} \cdot \left(y - \frac{t}{y}\right) \]
    16. metadata-eval96.2%

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

    \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in z around 0 96.3%

    \[\leadsto x + \color{blue}{-0.3333333333333333 \cdot \frac{y - \frac{t}{y}}{z}} \]
  6. Final simplification96.3%

    \[\leadsto x + -0.3333333333333333 \cdot \frac{y - \frac{t}{y}}{z} \]
  7. Add Preprocessing

Alternative 8: 64.0% accurate, 2.1× speedup?

\[\begin{array}{l} \\ x + \frac{y}{z} \cdot -0.3333333333333333 \end{array} \]
(FPCore (x y z t) :precision binary64 (+ x (* (/ y z) -0.3333333333333333)))
double code(double x, double y, double z, double t) {
	return x + ((y / z) * -0.3333333333333333);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x + ((y / z) * (-0.3333333333333333d0))
end function
public static double code(double x, double y, double z, double t) {
	return x + ((y / z) * -0.3333333333333333);
}
def code(x, y, z, t):
	return x + ((y / z) * -0.3333333333333333)
function code(x, y, z, t)
	return Float64(x + Float64(Float64(y / z) * -0.3333333333333333))
end
function tmp = code(x, y, z, t)
	tmp = x + ((y / z) * -0.3333333333333333);
end
code[x_, y_, z_, t_] := N[(x + N[(N[(y / z), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{y}{z} \cdot -0.3333333333333333
\end{array}
Derivation
  1. Initial program 97.5%

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
  2. Step-by-step derivation
    1. sub-neg97.5%

      \[\leadsto \color{blue}{\left(x + \left(-\frac{y}{z \cdot 3}\right)\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. associate-+l+97.5%

      \[\leadsto \color{blue}{x + \left(\left(-\frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
    3. remove-double-neg97.5%

      \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \color{blue}{\left(-\left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)}\right) \]
    4. distribute-frac-neg97.5%

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

      \[\leadsto x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right)} \]
    6. distribute-frac-neg97.5%

      \[\leadsto x + \left(\color{blue}{\frac{-y}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    7. neg-mul-197.5%

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

      \[\leadsto x + \left(\frac{\color{blue}{y \cdot -1}}{z \cdot 3} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    9. associate-/l*97.5%

      \[\leadsto x + \left(\color{blue}{y \cdot \frac{-1}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    10. *-commutative97.5%

      \[\leadsto x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    11. neg-mul-197.5%

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

      \[\leadsto x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]
    13. distribute-lft-out--96.2%

      \[\leadsto x + \color{blue}{\frac{-1}{z \cdot 3} \cdot \left(y - \frac{t}{y}\right)} \]
    14. *-commutative96.2%

      \[\leadsto x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]
    15. associate-/r*96.2%

      \[\leadsto x + \color{blue}{\frac{\frac{-1}{3}}{z}} \cdot \left(y - \frac{t}{y}\right) \]
    16. metadata-eval96.2%

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

    \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in y around inf 65.0%

    \[\leadsto x + \color{blue}{-0.3333333333333333 \cdot \frac{y}{z}} \]
  6. Final simplification65.0%

    \[\leadsto x + \frac{y}{z} \cdot -0.3333333333333333 \]
  7. Add Preprocessing

Alternative 9: 64.0% accurate, 2.1× speedup?

\[\begin{array}{l} \\ x + \frac{\frac{y}{z}}{-3} \end{array} \]
(FPCore (x y z t) :precision binary64 (+ x (/ (/ y z) -3.0)))
double code(double x, double y, double z, double t) {
	return x + ((y / z) / -3.0);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x + ((y / z) / (-3.0d0))
end function
public static double code(double x, double y, double z, double t) {
	return x + ((y / z) / -3.0);
}
def code(x, y, z, t):
	return x + ((y / z) / -3.0)
function code(x, y, z, t)
	return Float64(x + Float64(Float64(y / z) / -3.0))
end
function tmp = code(x, y, z, t)
	tmp = x + ((y / z) / -3.0);
end
code[x_, y_, z_, t_] := N[(x + N[(N[(y / z), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{\frac{y}{z}}{-3}
\end{array}
Derivation
  1. Initial program 97.5%

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
  2. Step-by-step derivation
    1. sub-neg97.5%

      \[\leadsto \color{blue}{\left(x + \left(-\frac{y}{z \cdot 3}\right)\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. associate-+l+97.5%

      \[\leadsto \color{blue}{x + \left(\left(-\frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
    3. remove-double-neg97.5%

      \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \color{blue}{\left(-\left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)}\right) \]
    4. distribute-frac-neg97.5%

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

      \[\leadsto x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right)} \]
    6. distribute-frac-neg97.5%

      \[\leadsto x + \left(\color{blue}{\frac{-y}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    7. neg-mul-197.5%

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

      \[\leadsto x + \left(\frac{\color{blue}{y \cdot -1}}{z \cdot 3} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    9. associate-/l*97.5%

      \[\leadsto x + \left(\color{blue}{y \cdot \frac{-1}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    10. *-commutative97.5%

      \[\leadsto x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    11. neg-mul-197.5%

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

      \[\leadsto x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]
    13. distribute-lft-out--96.2%

      \[\leadsto x + \color{blue}{\frac{-1}{z \cdot 3} \cdot \left(y - \frac{t}{y}\right)} \]
    14. *-commutative96.2%

      \[\leadsto x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]
    15. associate-/r*96.2%

      \[\leadsto x + \color{blue}{\frac{\frac{-1}{3}}{z}} \cdot \left(y - \frac{t}{y}\right) \]
    16. metadata-eval96.2%

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

    \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in y around inf 65.0%

    \[\leadsto x + \color{blue}{-0.3333333333333333 \cdot \frac{y}{z}} \]
  6. Step-by-step derivation
    1. *-commutative65.0%

      \[\leadsto x + \color{blue}{\frac{y}{z} \cdot -0.3333333333333333} \]
    2. metadata-eval65.0%

      \[\leadsto x + \frac{y}{z} \cdot \color{blue}{\frac{1}{-3}} \]
    3. div-inv65.0%

      \[\leadsto x + \color{blue}{\frac{\frac{y}{z}}{-3}} \]
  7. Applied egg-rr65.0%

    \[\leadsto x + \color{blue}{\frac{\frac{y}{z}}{-3}} \]
  8. Final simplification65.0%

    \[\leadsto x + \frac{\frac{y}{z}}{-3} \]
  9. Add Preprocessing

Alternative 10: 30.3% accurate, 15.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
	return x;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x
end function
public static double code(double x, double y, double z, double t) {
	return x;
}
def code(x, y, z, t):
	return x
function code(x, y, z, t)
	return x
end
function tmp = code(x, y, z, t)
	tmp = x;
end
code[x_, y_, z_, t_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 97.5%

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
  2. Step-by-step derivation
    1. sub-neg97.5%

      \[\leadsto \color{blue}{\left(x + \left(-\frac{y}{z \cdot 3}\right)\right)} + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. associate-+l+97.5%

      \[\leadsto \color{blue}{x + \left(\left(-\frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]
    3. remove-double-neg97.5%

      \[\leadsto x + \left(\left(-\frac{y}{z \cdot 3}\right) + \color{blue}{\left(-\left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)}\right) \]
    4. distribute-frac-neg97.5%

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

      \[\leadsto x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right)} \]
    6. distribute-frac-neg97.5%

      \[\leadsto x + \left(\color{blue}{\frac{-y}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    7. neg-mul-197.5%

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

      \[\leadsto x + \left(\frac{\color{blue}{y \cdot -1}}{z \cdot 3} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    9. associate-/l*97.5%

      \[\leadsto x + \left(\color{blue}{y \cdot \frac{-1}{z \cdot 3}} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    10. *-commutative97.5%

      \[\leadsto x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \frac{-t}{\left(z \cdot 3\right) \cdot y}\right) \]
    11. neg-mul-197.5%

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

      \[\leadsto x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]
    13. distribute-lft-out--96.2%

      \[\leadsto x + \color{blue}{\frac{-1}{z \cdot 3} \cdot \left(y - \frac{t}{y}\right)} \]
    14. *-commutative96.2%

      \[\leadsto x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]
    15. associate-/r*96.2%

      \[\leadsto x + \color{blue}{\frac{\frac{-1}{3}}{z}} \cdot \left(y - \frac{t}{y}\right) \]
    16. metadata-eval96.2%

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

    \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in y around inf 65.0%

    \[\leadsto x + \color{blue}{-0.3333333333333333 \cdot \frac{y}{z}} \]
  6. Taylor expanded in x around inf 31.6%

    \[\leadsto \color{blue}{x} \]
  7. Final simplification31.6%

    \[\leadsto x \]
  8. Add Preprocessing

Developer target: 95.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y)))
double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x - (y / (z * 3.0d0))) + ((t / (z * 3.0d0)) / y)
end function
public static double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
}
def code(x, y, z, t):
	return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y)
function code(x, y, z, t)
	return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / Float64(z * 3.0)) / y))
end
function tmp = code(x, y, z, t)
	tmp = (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(z * 3.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Reproduce

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

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

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