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

Percentage Accurate: 95.9% → 97.5%
Time: 12.8s
Alternatives: 17
Speedup: 0.7×

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 17 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.9% 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: 97.5% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot 3 \leq -0.5:\\ \;\;\;\;x + \mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, \frac{t}{3 \cdot \left(z \cdot y\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{t}{y} - y}{z \cdot 3}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z 3.0) -0.5)
   (+ x (fma -0.3333333333333333 (/ y z) (/ t (* 3.0 (* z y)))))
   (+ x (/ (- (/ t y) y) (* z 3.0)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * 3.0) <= -0.5) {
		tmp = x + fma(-0.3333333333333333, (y / z), (t / (3.0 * (z * y))));
	} else {
		tmp = x + (((t / y) - y) / (z * 3.0));
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * 3.0) <= -0.5)
		tmp = Float64(x + fma(-0.3333333333333333, Float64(y / z), Float64(t / Float64(3.0 * Float64(z * y)))));
	else
		tmp = Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(z * 3.0)));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], -0.5], N[(x + N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + N[(t / N[(3.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq -0.5:\\
\;\;\;\;x + \mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, \frac{t}{3 \cdot \left(z \cdot y\right)}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z 3) < -0.5

    1. Initial program 98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.5 < (*.f64 z 3)

    1. Initial program 95.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
    6. Applied egg-rr98.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot 3 \leq -0.5:\\ \;\;\;\;x + \mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, \frac{t}{3 \cdot \left(z \cdot y\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{t}{y} - y}{z \cdot 3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 80.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq -1 \cdot 10^{+131} \lor \neg \left(z \cdot 3 \leq 10^{+128}\right):\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z 3) < -9.9999999999999991e130 or 1.0000000000000001e128 < (*.f64 z 3)

    1. Initial program 97.2%

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

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

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

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

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

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

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

    if -9.9999999999999991e130 < (*.f64 z 3) < 1.0000000000000001e128

    1. Initial program 95.6%

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot \frac{t}{y} - 0.3333333333333333 \cdot y}{z}} \]
    6. Step-by-step derivation
      1. distribute-lft-out--86.4%

        \[\leadsto \frac{\color{blue}{0.3333333333333333 \cdot \left(\frac{t}{y} - y\right)}}{z} \]
      2. *-un-lft-identity86.4%

        \[\leadsto \frac{0.3333333333333333 \cdot \left(\frac{t}{y} - y\right)}{\color{blue}{1 \cdot z}} \]
      3. times-frac86.4%

        \[\leadsto \color{blue}{\frac{0.3333333333333333}{1} \cdot \frac{\frac{t}{y} - y}{z}} \]
      4. metadata-eval86.4%

        \[\leadsto \color{blue}{0.3333333333333333} \cdot \frac{\frac{t}{y} - y}{z} \]
    7. Applied egg-rr86.4%

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

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

Alternative 3: 62.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\frac{-y}{z}}{3}\\ \mathbf{if}\;y \leq -4.4 \cdot 10^{+28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -0.0006:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-10}:\\ \;\;\;\;t \cdot \frac{\frac{0.3333333333333333}{z}}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (/ (- y) z) 3.0)))
   (if (<= y -4.4e+28)
     t_1
     (if (<= y -0.0006)
       x
       (if (<= y 4.6e-10) (* t (/ (/ 0.3333333333333333 z) y)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = (-y / z) / 3.0;
	double tmp;
	if (y <= -4.4e+28) {
		tmp = t_1;
	} else if (y <= -0.0006) {
		tmp = x;
	} else if (y <= 4.6e-10) {
		tmp = t * ((0.3333333333333333 / z) / y);
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_1 = (-y / z) / 3.0d0
    if (y <= (-4.4d+28)) then
        tmp = t_1
    else if (y <= (-0.0006d0)) then
        tmp = x
    else if (y <= 4.6d-10) then
        tmp = t * ((0.3333333333333333d0 / z) / y)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (-y / z) / 3.0;
	double tmp;
	if (y <= -4.4e+28) {
		tmp = t_1;
	} else if (y <= -0.0006) {
		tmp = x;
	} else if (y <= 4.6e-10) {
		tmp = t * ((0.3333333333333333 / z) / y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (-y / z) / 3.0
	tmp = 0
	if y <= -4.4e+28:
		tmp = t_1
	elif y <= -0.0006:
		tmp = x
	elif y <= 4.6e-10:
		tmp = t * ((0.3333333333333333 / z) / y)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(Float64(-y) / z) / 3.0)
	tmp = 0.0
	if (y <= -4.4e+28)
		tmp = t_1;
	elseif (y <= -0.0006)
		tmp = x;
	elseif (y <= 4.6e-10)
		tmp = Float64(t * Float64(Float64(0.3333333333333333 / z) / y));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (-y / z) / 3.0;
	tmp = 0.0;
	if (y <= -4.4e+28)
		tmp = t_1;
	elseif (y <= -0.0006)
		tmp = x;
	elseif (y <= 4.6e-10)
		tmp = t * ((0.3333333333333333 / z) / y);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[((-y) / z), $MachinePrecision] / 3.0), $MachinePrecision]}, If[LessEqual[y, -4.4e+28], t$95$1, If[LessEqual[y, -0.0006], x, If[LessEqual[y, 4.6e-10], N[(t * N[(N[(0.3333333333333333 / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{\frac{-y}{z}}{3}\\
\mathbf{if}\;y \leq -4.4 \cdot 10^{+28}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -0.0006:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 4.6 \cdot 10^{-10}:\\
\;\;\;\;t \cdot \frac{\frac{0.3333333333333333}{z}}{y}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.39999999999999973e28 or 4.60000000000000014e-10 < y

    1. Initial program 96.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot \frac{t}{y} - 0.3333333333333333 \cdot y}{z}} \]
    6. Taylor expanded in t around 0 68.2%

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

        \[\leadsto \frac{\color{blue}{y \cdot -0.3333333333333333}}{z} \]
    8. Simplified68.2%

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

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

        \[\leadsto \color{blue}{\frac{-0.3333333333333333}{z} \cdot y} \]
    10. Applied egg-rr68.1%

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

        \[\leadsto \color{blue}{y \cdot \frac{-0.3333333333333333}{z}} \]
      2. div-inv68.1%

        \[\leadsto y \cdot \color{blue}{\left(-0.3333333333333333 \cdot \frac{1}{z}\right)} \]
      3. metadata-eval68.1%

        \[\leadsto y \cdot \left(\color{blue}{\left(-0.3333333333333333\right)} \cdot \frac{1}{z}\right) \]
      4. distribute-lft-neg-in68.1%

        \[\leadsto y \cdot \color{blue}{\left(-0.3333333333333333 \cdot \frac{1}{z}\right)} \]
      5. div-inv68.1%

        \[\leadsto y \cdot \left(-\color{blue}{\frac{0.3333333333333333}{z}}\right) \]
      6. distribute-rgt-neg-in68.1%

        \[\leadsto \color{blue}{-y \cdot \frac{0.3333333333333333}{z}} \]
      7. metadata-eval68.1%

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

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

        \[\leadsto -y \cdot \frac{1}{\color{blue}{z \cdot 3}} \]
      10. div-inv67.5%

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

        \[\leadsto -\color{blue}{\frac{\frac{y}{z}}{3}} \]
      12. distribute-neg-frac68.3%

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

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

    if -4.39999999999999973e28 < y < -5.99999999999999947e-4

    1. Initial program 99.8%

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

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

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

    if -5.99999999999999947e-4 < y < 4.60000000000000014e-10

    1. Initial program 94.8%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{t}{y} \cdot \frac{0.3333333333333333}{z}} \]
      3. div-inv66.9%

        \[\leadsto \color{blue}{\left(t \cdot \frac{1}{y}\right)} \cdot \frac{0.3333333333333333}{z} \]
      4. associate-*l*68.4%

        \[\leadsto \color{blue}{t \cdot \left(\frac{1}{y} \cdot \frac{0.3333333333333333}{z}\right)} \]
    8. Applied egg-rr68.4%

      \[\leadsto \color{blue}{t \cdot \left(\frac{1}{y} \cdot \frac{0.3333333333333333}{z}\right)} \]
    9. Step-by-step derivation
      1. associate-*l/69.4%

        \[\leadsto t \cdot \color{blue}{\frac{1 \cdot \frac{0.3333333333333333}{z}}{y}} \]
      2. *-lft-identity69.4%

        \[\leadsto t \cdot \frac{\color{blue}{\frac{0.3333333333333333}{z}}}{y} \]
    10. Simplified69.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.4 \cdot 10^{+28}:\\ \;\;\;\;\frac{\frac{-y}{z}}{3}\\ \mathbf{elif}\;y \leq -0.0006:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-10}:\\ \;\;\;\;t \cdot \frac{\frac{0.3333333333333333}{z}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-y}{z}}{3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 64.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\frac{-y}{z}}{3}\\ \mathbf{if}\;y \leq -4.7 \cdot 10^{+28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -0.00072:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{-10}:\\ \;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (/ (- y) z) 3.0)))
   (if (<= y -4.7e+28)
     t_1
     (if (<= y -0.00072)
       x
       (if (<= y 4.2e-10) (* (/ t z) (/ 0.3333333333333333 y)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = (-y / z) / 3.0;
	double tmp;
	if (y <= -4.7e+28) {
		tmp = t_1;
	} else if (y <= -0.00072) {
		tmp = x;
	} else if (y <= 4.2e-10) {
		tmp = (t / z) * (0.3333333333333333 / y);
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_1 = (-y / z) / 3.0d0
    if (y <= (-4.7d+28)) then
        tmp = t_1
    else if (y <= (-0.00072d0)) then
        tmp = x
    else if (y <= 4.2d-10) then
        tmp = (t / z) * (0.3333333333333333d0 / y)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (-y / z) / 3.0;
	double tmp;
	if (y <= -4.7e+28) {
		tmp = t_1;
	} else if (y <= -0.00072) {
		tmp = x;
	} else if (y <= 4.2e-10) {
		tmp = (t / z) * (0.3333333333333333 / y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (-y / z) / 3.0
	tmp = 0
	if y <= -4.7e+28:
		tmp = t_1
	elif y <= -0.00072:
		tmp = x
	elif y <= 4.2e-10:
		tmp = (t / z) * (0.3333333333333333 / y)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(Float64(-y) / z) / 3.0)
	tmp = 0.0
	if (y <= -4.7e+28)
		tmp = t_1;
	elseif (y <= -0.00072)
		tmp = x;
	elseif (y <= 4.2e-10)
		tmp = Float64(Float64(t / z) * Float64(0.3333333333333333 / y));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (-y / z) / 3.0;
	tmp = 0.0;
	if (y <= -4.7e+28)
		tmp = t_1;
	elseif (y <= -0.00072)
		tmp = x;
	elseif (y <= 4.2e-10)
		tmp = (t / z) * (0.3333333333333333 / y);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[((-y) / z), $MachinePrecision] / 3.0), $MachinePrecision]}, If[LessEqual[y, -4.7e+28], t$95$1, If[LessEqual[y, -0.00072], x, If[LessEqual[y, 4.2e-10], N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{\frac{-y}{z}}{3}\\
\mathbf{if}\;y \leq -4.7 \cdot 10^{+28}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -0.00072:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 4.2 \cdot 10^{-10}:\\
\;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.69999999999999965e28 or 4.2e-10 < y

    1. Initial program 96.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot \frac{t}{y} - 0.3333333333333333 \cdot y}{z}} \]
    6. Taylor expanded in t around 0 68.2%

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

        \[\leadsto \frac{\color{blue}{y \cdot -0.3333333333333333}}{z} \]
    8. Simplified68.2%

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

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

        \[\leadsto \color{blue}{\frac{-0.3333333333333333}{z} \cdot y} \]
    10. Applied egg-rr68.1%

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

        \[\leadsto \color{blue}{y \cdot \frac{-0.3333333333333333}{z}} \]
      2. div-inv68.1%

        \[\leadsto y \cdot \color{blue}{\left(-0.3333333333333333 \cdot \frac{1}{z}\right)} \]
      3. metadata-eval68.1%

        \[\leadsto y \cdot \left(\color{blue}{\left(-0.3333333333333333\right)} \cdot \frac{1}{z}\right) \]
      4. distribute-lft-neg-in68.1%

        \[\leadsto y \cdot \color{blue}{\left(-0.3333333333333333 \cdot \frac{1}{z}\right)} \]
      5. div-inv68.1%

        \[\leadsto y \cdot \left(-\color{blue}{\frac{0.3333333333333333}{z}}\right) \]
      6. distribute-rgt-neg-in68.1%

        \[\leadsto \color{blue}{-y \cdot \frac{0.3333333333333333}{z}} \]
      7. metadata-eval68.1%

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

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

        \[\leadsto -y \cdot \frac{1}{\color{blue}{z \cdot 3}} \]
      10. div-inv67.5%

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

        \[\leadsto -\color{blue}{\frac{\frac{y}{z}}{3}} \]
      12. distribute-neg-frac68.3%

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

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

    if -4.69999999999999965e28 < y < -7.20000000000000045e-4

    1. Initial program 99.8%

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

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

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

    if -7.20000000000000045e-4 < y < 4.2e-10

    1. Initial program 94.8%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{0.3333333333333333 \cdot \frac{t}{y}}}{z} \]
    7. Step-by-step derivation
      1. associate-*r/68.5%

        \[\leadsto \frac{\color{blue}{\frac{0.3333333333333333 \cdot t}{y}}}{z} \]
      2. *-commutative68.5%

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

        \[\leadsto \color{blue}{\frac{t \cdot 0.3333333333333333}{z \cdot y}} \]
      4. times-frac72.6%

        \[\leadsto \color{blue}{\frac{t}{z} \cdot \frac{0.3333333333333333}{y}} \]
    8. Applied egg-rr72.6%

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

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

Alternative 5: 97.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot 3 \leq -4 \cdot 10^{+14}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \left(3 \cdot y\right)}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{t}{y} - y}{z \cdot 3}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z 3.0) -4e+14)
   (+ (- x (/ y (* z 3.0))) (/ t (* z (* 3.0 y))))
   (+ x (/ (- (/ t y) y) (* z 3.0)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * 3.0) <= -4e+14) {
		tmp = (x - (y / (z * 3.0))) + (t / (z * (3.0 * y)));
	} else {
		tmp = x + (((t / y) - y) / (z * 3.0));
	}
	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 ((z * 3.0d0) <= (-4d+14)) then
        tmp = (x - (y / (z * 3.0d0))) + (t / (z * (3.0d0 * y)))
    else
        tmp = x + (((t / y) - y) / (z * 3.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * 3.0) <= -4e+14) {
		tmp = (x - (y / (z * 3.0))) + (t / (z * (3.0 * y)));
	} else {
		tmp = x + (((t / y) - y) / (z * 3.0));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z * 3.0) <= -4e+14:
		tmp = (x - (y / (z * 3.0))) + (t / (z * (3.0 * y)))
	else:
		tmp = x + (((t / y) - y) / (z * 3.0))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * 3.0) <= -4e+14)
		tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(z * Float64(3.0 * y))));
	else
		tmp = Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(z * 3.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z * 3.0) <= -4e+14)
		tmp = (x - (y / (z * 3.0))) + (t / (z * (3.0 * y)));
	else
		tmp = x + (((t / y) - y) / (z * 3.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], -4e+14], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(z * N[(3.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq -4 \cdot 10^{+14}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \left(3 \cdot y\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z 3) < -4e14

    1. Initial program 98.1%

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

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

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

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

    if -4e14 < (*.f64 z 3)

    1. Initial program 95.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
    6. Applied egg-rr98.4%

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

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

Alternative 6: 97.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot 3 \leq -4 \cdot 10^{+14}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{t}{y} - y}{z \cdot 3}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z 3.0) -4e+14)
   (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y)))
   (+ x (/ (- (/ t y) y) (* z 3.0)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * 3.0) <= -4e+14) {
		tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
	} else {
		tmp = x + (((t / y) - y) / (z * 3.0));
	}
	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 ((z * 3.0d0) <= (-4d+14)) then
        tmp = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
    else
        tmp = x + (((t / y) - y) / (z * 3.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * 3.0) <= -4e+14) {
		tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
	} else {
		tmp = x + (((t / y) - y) / (z * 3.0));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z * 3.0) <= -4e+14:
		tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
	else:
		tmp = x + (((t / y) - y) / (z * 3.0))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * 3.0) <= -4e+14)
		tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y)));
	else
		tmp = Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(z * 3.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z * 3.0) <= -4e+14)
		tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
	else
		tmp = x + (((t / y) - y) / (z * 3.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], -4e+14], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq -4 \cdot 10^{+14}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z 3) < -4e14

    1. Initial program 98.1%

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

    if -4e14 < (*.f64 z 3)

    1. Initial program 95.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \color{blue}{\frac{y - \frac{t}{y}}{z \cdot 3}} \]
    6. Applied egg-rr98.4%

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

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

Alternative 7: 46.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot 3 \leq -2 \cdot 10^{+120}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \cdot 3 \leq 10^{+49}:\\ \;\;\;\;\frac{-y}{z \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z 3.0) -2e+120) x (if (<= (* z 3.0) 1e+49) (/ (- y) (* z 3.0)) x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * 3.0) <= -2e+120) {
		tmp = x;
	} else if ((z * 3.0) <= 1e+49) {
		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 ((z * 3.0d0) <= (-2d+120)) then
        tmp = x
    else if ((z * 3.0d0) <= 1d+49) 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 ((z * 3.0) <= -2e+120) {
		tmp = x;
	} else if ((z * 3.0) <= 1e+49) {
		tmp = -y / (z * 3.0);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z * 3.0) <= -2e+120:
		tmp = x
	elif (z * 3.0) <= 1e+49:
		tmp = -y / (z * 3.0)
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * 3.0) <= -2e+120)
		tmp = x;
	elseif (Float64(z * 3.0) <= 1e+49)
		tmp = Float64(Float64(-y) / Float64(z * 3.0));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z * 3.0) <= -2e+120)
		tmp = x;
	elseif ((z * 3.0) <= 1e+49)
		tmp = -y / (z * 3.0);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], -2e+120], x, If[LessEqual[N[(z * 3.0), $MachinePrecision], 1e+49], N[((-y) / N[(z * 3.0), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq -2 \cdot 10^{+120}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z 3) < -2e120 or 9.99999999999999946e48 < (*.f64 z 3)

    1. Initial program 97.7%

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

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

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

    if -2e120 < (*.f64 z 3) < 9.99999999999999946e48

    1. Initial program 95.1%

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot \frac{t}{y} - 0.3333333333333333 \cdot y}{z}} \]
    6. Taylor expanded in t around 0 46.6%

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

        \[\leadsto \frac{\color{blue}{y \cdot -0.3333333333333333}}{z} \]
    8. Simplified46.6%

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

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

        \[\leadsto \color{blue}{\frac{-0.3333333333333333}{z} \cdot y} \]
    10. Applied egg-rr46.6%

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

        \[\leadsto \color{blue}{y \cdot \frac{-0.3333333333333333}{z}} \]
      2. div-inv46.6%

        \[\leadsto y \cdot \color{blue}{\left(-0.3333333333333333 \cdot \frac{1}{z}\right)} \]
      3. metadata-eval46.6%

        \[\leadsto y \cdot \left(\color{blue}{\left(-0.3333333333333333\right)} \cdot \frac{1}{z}\right) \]
      4. distribute-lft-neg-in46.6%

        \[\leadsto y \cdot \color{blue}{\left(-0.3333333333333333 \cdot \frac{1}{z}\right)} \]
      5. div-inv46.6%

        \[\leadsto y \cdot \left(-\color{blue}{\frac{0.3333333333333333}{z}}\right) \]
      6. distribute-rgt-neg-in46.6%

        \[\leadsto \color{blue}{-y \cdot \frac{0.3333333333333333}{z}} \]
      7. metadata-eval46.6%

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

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

        \[\leadsto -y \cdot \frac{1}{\color{blue}{z \cdot 3}} \]
      10. div-inv46.6%

        \[\leadsto -\color{blue}{\frac{y}{z \cdot 3}} \]
      11. distribute-neg-frac46.6%

        \[\leadsto \color{blue}{\frac{-y}{z \cdot 3}} \]
    12. Applied egg-rr46.6%

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

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

Alternative 8: 46.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot 3 \leq -2 \cdot 10^{+120}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \cdot 3 \leq 10^{+49}:\\ \;\;\;\;\frac{\frac{-y}{z}}{3}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z 3.0) -2e+120) x (if (<= (* z 3.0) 1e+49) (/ (/ (- y) z) 3.0) x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * 3.0) <= -2e+120) {
		tmp = x;
	} else if ((z * 3.0) <= 1e+49) {
		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 ((z * 3.0d0) <= (-2d+120)) then
        tmp = x
    else if ((z * 3.0d0) <= 1d+49) 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 ((z * 3.0) <= -2e+120) {
		tmp = x;
	} else if ((z * 3.0) <= 1e+49) {
		tmp = (-y / z) / 3.0;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z * 3.0) <= -2e+120:
		tmp = x
	elif (z * 3.0) <= 1e+49:
		tmp = (-y / z) / 3.0
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * 3.0) <= -2e+120)
		tmp = x;
	elseif (Float64(z * 3.0) <= 1e+49)
		tmp = Float64(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 ((z * 3.0) <= -2e+120)
		tmp = x;
	elseif ((z * 3.0) <= 1e+49)
		tmp = (-y / z) / 3.0;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], -2e+120], x, If[LessEqual[N[(z * 3.0), $MachinePrecision], 1e+49], N[(N[((-y) / z), $MachinePrecision] / 3.0), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq -2 \cdot 10^{+120}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z 3) < -2e120 or 9.99999999999999946e48 < (*.f64 z 3)

    1. Initial program 97.7%

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

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

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

    if -2e120 < (*.f64 z 3) < 9.99999999999999946e48

    1. Initial program 95.1%

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot \frac{t}{y} - 0.3333333333333333 \cdot y}{z}} \]
    6. Taylor expanded in t around 0 46.6%

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

        \[\leadsto \frac{\color{blue}{y \cdot -0.3333333333333333}}{z} \]
    8. Simplified46.6%

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

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

        \[\leadsto \color{blue}{\frac{-0.3333333333333333}{z} \cdot y} \]
    10. Applied egg-rr46.6%

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

        \[\leadsto \color{blue}{y \cdot \frac{-0.3333333333333333}{z}} \]
      2. div-inv46.6%

        \[\leadsto y \cdot \color{blue}{\left(-0.3333333333333333 \cdot \frac{1}{z}\right)} \]
      3. metadata-eval46.6%

        \[\leadsto y \cdot \left(\color{blue}{\left(-0.3333333333333333\right)} \cdot \frac{1}{z}\right) \]
      4. distribute-lft-neg-in46.6%

        \[\leadsto y \cdot \color{blue}{\left(-0.3333333333333333 \cdot \frac{1}{z}\right)} \]
      5. div-inv46.6%

        \[\leadsto y \cdot \left(-\color{blue}{\frac{0.3333333333333333}{z}}\right) \]
      6. distribute-rgt-neg-in46.6%

        \[\leadsto \color{blue}{-y \cdot \frac{0.3333333333333333}{z}} \]
      7. metadata-eval46.6%

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

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

        \[\leadsto -y \cdot \frac{1}{\color{blue}{z \cdot 3}} \]
      10. div-inv46.6%

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

        \[\leadsto -\color{blue}{\frac{\frac{y}{z}}{3}} \]
      12. distribute-neg-frac46.6%

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

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

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

Alternative 9: 46.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot 3 \leq -2 \cdot 10^{+120}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \cdot 3 \leq 10^{+49}:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z 3.0) -2e+120)
   x
   (if (<= (* z 3.0) 1e+49) (* -0.3333333333333333 (/ y z)) x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * 3.0) <= -2e+120) {
		tmp = x;
	} else if ((z * 3.0) <= 1e+49) {
		tmp = -0.3333333333333333 * (y / z);
	} 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 ((z * 3.0d0) <= (-2d+120)) then
        tmp = x
    else if ((z * 3.0d0) <= 1d+49) then
        tmp = (-0.3333333333333333d0) * (y / z)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * 3.0) <= -2e+120) {
		tmp = x;
	} else if ((z * 3.0) <= 1e+49) {
		tmp = -0.3333333333333333 * (y / z);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z * 3.0) <= -2e+120:
		tmp = x
	elif (z * 3.0) <= 1e+49:
		tmp = -0.3333333333333333 * (y / z)
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * 3.0) <= -2e+120)
		tmp = x;
	elseif (Float64(z * 3.0) <= 1e+49)
		tmp = Float64(-0.3333333333333333 * Float64(y / z));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z * 3.0) <= -2e+120)
		tmp = x;
	elseif ((z * 3.0) <= 1e+49)
		tmp = -0.3333333333333333 * (y / z);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], -2e+120], x, If[LessEqual[N[(z * 3.0), $MachinePrecision], 1e+49], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq -2 \cdot 10^{+120}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \cdot 3 \leq 10^{+49}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z 3) < -2e120 or 9.99999999999999946e48 < (*.f64 z 3)

    1. Initial program 97.7%

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

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

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

    if -2e120 < (*.f64 z 3) < 9.99999999999999946e48

    1. Initial program 95.1%

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot \frac{t}{y} - 0.3333333333333333 \cdot y}{z}} \]
    6. Taylor expanded in t around 0 46.6%

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

        \[\leadsto \frac{\color{blue}{y \cdot -0.3333333333333333}}{z} \]
    8. Simplified46.6%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{-0.3333333333333333}}} \]
      2. associate-/r/46.6%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot -0.3333333333333333} \]
    10. Applied egg-rr46.6%

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

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

Alternative 10: 92.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{+28}:\\ \;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-10}:\\ \;\;\;\;x + 0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{z \cdot -3}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -3.1e+28)
   (- x (* (/ y z) 0.3333333333333333))
   (if (<= y 4.6e-10)
     (+ x (* 0.3333333333333333 (/ (/ t z) y)))
     (+ x (/ y (* z -3.0))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -3.1e+28) {
		tmp = x - ((y / z) * 0.3333333333333333);
	} else if (y <= 4.6e-10) {
		tmp = x + (0.3333333333333333 * ((t / z) / y));
	} else {
		tmp = x + (y / (z * -3.0));
	}
	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 <= (-3.1d+28)) then
        tmp = x - ((y / z) * 0.3333333333333333d0)
    else if (y <= 4.6d-10) then
        tmp = x + (0.3333333333333333d0 * ((t / z) / y))
    else
        tmp = x + (y / (z * (-3.0d0)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -3.1e+28) {
		tmp = x - ((y / z) * 0.3333333333333333);
	} else if (y <= 4.6e-10) {
		tmp = x + (0.3333333333333333 * ((t / z) / y));
	} else {
		tmp = x + (y / (z * -3.0));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -3.1e+28:
		tmp = x - ((y / z) * 0.3333333333333333)
	elif y <= 4.6e-10:
		tmp = x + (0.3333333333333333 * ((t / z) / y))
	else:
		tmp = x + (y / (z * -3.0))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -3.1e+28)
		tmp = Float64(x - Float64(Float64(y / z) * 0.3333333333333333));
	elseif (y <= 4.6e-10)
		tmp = Float64(x + Float64(0.3333333333333333 * Float64(Float64(t / z) / y)));
	else
		tmp = Float64(x + Float64(y / Float64(z * -3.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -3.1e+28)
		tmp = x - ((y / z) * 0.3333333333333333);
	elseif (y <= 4.6e-10)
		tmp = x + (0.3333333333333333 * ((t / z) / y));
	else
		tmp = x + (y / (z * -3.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.1e+28], N[(x - N[(N[(y / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.6e-10], N[(x + N[(0.3333333333333333 * N[(N[(t / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{+28}:\\
\;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.1000000000000001e28

    1. Initial program 96.7%

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

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

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

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

      \[\leadsto \color{blue}{x - 0.3333333333333333 \cdot \frac{y}{z}} \]

    if -3.1000000000000001e28 < y < 4.60000000000000014e-10

    1. Initial program 95.1%

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

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

      \[\leadsto x + \color{blue}{0.3333333333333333 \cdot \frac{t}{y \cdot z}} \]
    5. Step-by-step derivation
      1. associate-*r/90.5%

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

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

        \[\leadsto x + \color{blue}{\frac{\frac{0.3333333333333333 \cdot t}{z}}{y}} \]
      4. associate-*r/93.5%

        \[\leadsto x + \frac{\color{blue}{0.3333333333333333 \cdot \frac{t}{z}}}{y} \]
      5. *-rgt-identity93.5%

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

        \[\leadsto x + \color{blue}{\left(0.3333333333333333 \cdot \frac{t}{z}\right) \cdot \frac{1}{y}} \]
      7. associate-*l*92.1%

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

        \[\leadsto x + 0.3333333333333333 \cdot \color{blue}{\frac{\frac{t}{z} \cdot 1}{y}} \]
      9. *-rgt-identity92.9%

        \[\leadsto x + 0.3333333333333333 \cdot \frac{\color{blue}{\frac{t}{z}}}{y} \]
    6. Simplified92.9%

      \[\leadsto x + \color{blue}{0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}} \]

    if 4.60000000000000014e-10 < y

    1. Initial program 97.1%

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

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

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

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

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

        \[\leadsto x + \color{blue}{y \cdot \frac{-0.3333333333333333}{z}} \]
    6. Simplified92.5%

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

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

        \[\leadsto x + \color{blue}{\frac{y}{\frac{z}{-0.3333333333333333}}} \]
      3. div-inv92.6%

        \[\leadsto x + \frac{y}{\color{blue}{z \cdot \frac{1}{-0.3333333333333333}}} \]
      4. metadata-eval92.6%

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

      \[\leadsto x + \color{blue}{\frac{y}{z \cdot -3}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification93.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{+28}:\\ \;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-10}:\\ \;\;\;\;x + 0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{z \cdot -3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 92.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.7 \cdot 10^{+28}:\\ \;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-10}:\\ \;\;\;\;x + \frac{0.3333333333333333}{\frac{y}{\frac{t}{z}}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{z \cdot -3}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -1.7e+28)
   (- x (* (/ y z) 0.3333333333333333))
   (if (<= y 4.4e-10)
     (+ x (/ 0.3333333333333333 (/ y (/ t z))))
     (+ x (/ y (* z -3.0))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.7e+28) {
		tmp = x - ((y / z) * 0.3333333333333333);
	} else if (y <= 4.4e-10) {
		tmp = x + (0.3333333333333333 / (y / (t / z)));
	} else {
		tmp = x + (y / (z * -3.0));
	}
	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 <= (-1.7d+28)) then
        tmp = x - ((y / z) * 0.3333333333333333d0)
    else if (y <= 4.4d-10) then
        tmp = x + (0.3333333333333333d0 / (y / (t / z)))
    else
        tmp = x + (y / (z * (-3.0d0)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.7e+28) {
		tmp = x - ((y / z) * 0.3333333333333333);
	} else if (y <= 4.4e-10) {
		tmp = x + (0.3333333333333333 / (y / (t / z)));
	} else {
		tmp = x + (y / (z * -3.0));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -1.7e+28:
		tmp = x - ((y / z) * 0.3333333333333333)
	elif y <= 4.4e-10:
		tmp = x + (0.3333333333333333 / (y / (t / z)))
	else:
		tmp = x + (y / (z * -3.0))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -1.7e+28)
		tmp = Float64(x - Float64(Float64(y / z) * 0.3333333333333333));
	elseif (y <= 4.4e-10)
		tmp = Float64(x + Float64(0.3333333333333333 / Float64(y / Float64(t / z))));
	else
		tmp = Float64(x + Float64(y / Float64(z * -3.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -1.7e+28)
		tmp = x - ((y / z) * 0.3333333333333333);
	elseif (y <= 4.4e-10)
		tmp = x + (0.3333333333333333 / (y / (t / z)));
	else
		tmp = x + (y / (z * -3.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.7e+28], N[(x - N[(N[(y / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.4e-10], N[(x + N[(0.3333333333333333 / N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{+28}:\\
\;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.7e28

    1. Initial program 96.7%

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

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

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

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

      \[\leadsto \color{blue}{x - 0.3333333333333333 \cdot \frac{y}{z}} \]

    if -1.7e28 < y < 4.3999999999999998e-10

    1. Initial program 95.1%

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

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

      \[\leadsto x + \color{blue}{0.3333333333333333 \cdot \frac{t}{y \cdot z}} \]
    5. Step-by-step derivation
      1. associate-*r/90.5%

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

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

        \[\leadsto x + \color{blue}{\frac{\frac{0.3333333333333333 \cdot t}{z}}{y}} \]
      4. associate-*r/93.5%

        \[\leadsto x + \frac{\color{blue}{0.3333333333333333 \cdot \frac{t}{z}}}{y} \]
      5. *-rgt-identity93.5%

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

        \[\leadsto x + \color{blue}{\left(0.3333333333333333 \cdot \frac{t}{z}\right) \cdot \frac{1}{y}} \]
      7. associate-*l*92.1%

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

        \[\leadsto x + 0.3333333333333333 \cdot \color{blue}{\frac{\frac{t}{z} \cdot 1}{y}} \]
      9. *-rgt-identity92.9%

        \[\leadsto x + 0.3333333333333333 \cdot \frac{\color{blue}{\frac{t}{z}}}{y} \]
    6. Simplified92.9%

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

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

        \[\leadsto x + \color{blue}{\frac{0.3333333333333333}{\frac{y}{\frac{t}{z}}}} \]
    8. Applied egg-rr93.5%

      \[\leadsto x + \color{blue}{\frac{0.3333333333333333}{\frac{y}{\frac{t}{z}}}} \]

    if 4.3999999999999998e-10 < y

    1. Initial program 97.1%

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

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

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

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

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

        \[\leadsto x + \color{blue}{y \cdot \frac{-0.3333333333333333}{z}} \]
    6. Simplified92.5%

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

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

        \[\leadsto x + \color{blue}{\frac{y}{\frac{z}{-0.3333333333333333}}} \]
      3. div-inv92.6%

        \[\leadsto x + \frac{y}{\color{blue}{z \cdot \frac{1}{-0.3333333333333333}}} \]
      4. metadata-eval92.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.7 \cdot 10^{+28}:\\ \;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-10}:\\ \;\;\;\;x + \frac{0.3333333333333333}{\frac{y}{\frac{t}{z}}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{z \cdot -3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 78.0% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-73} \lor \neg \left(y \leq 4 \cdot 10^{-10}\right):\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.14999999999999994e-73 or 4.00000000000000015e-10 < y

    1. Initial program 96.7%

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

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

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

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

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

        \[\leadsto x + \color{blue}{y \cdot \frac{-0.3333333333333333}{z}} \]
    6. Simplified89.7%

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

    if -1.14999999999999994e-73 < y < 4.00000000000000015e-10

    1. Initial program 95.1%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{0.3333333333333333 \cdot \frac{t}{y}}}{z} \]
    7. Step-by-step derivation
      1. associate-*r/71.5%

        \[\leadsto \frac{\color{blue}{\frac{0.3333333333333333 \cdot t}{y}}}{z} \]
      2. *-commutative71.5%

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

        \[\leadsto \color{blue}{\frac{t \cdot 0.3333333333333333}{z \cdot y}} \]
      4. times-frac76.1%

        \[\leadsto \color{blue}{\frac{t}{z} \cdot \frac{0.3333333333333333}{y}} \]
    8. Applied egg-rr76.1%

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

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

Alternative 13: 78.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{-73}:\\ \;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{-10}:\\ \;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{z \cdot -3}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -2.5e-73)
   (+ x (* y (/ -0.3333333333333333 z)))
   (if (<= y 3.7e-10)
     (* (/ t z) (/ 0.3333333333333333 y))
     (+ x (/ y (* z -3.0))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -2.5e-73) {
		tmp = x + (y * (-0.3333333333333333 / z));
	} else if (y <= 3.7e-10) {
		tmp = (t / z) * (0.3333333333333333 / y);
	} else {
		tmp = x + (y / (z * -3.0));
	}
	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 <= (-2.5d-73)) then
        tmp = x + (y * ((-0.3333333333333333d0) / z))
    else if (y <= 3.7d-10) then
        tmp = (t / z) * (0.3333333333333333d0 / y)
    else
        tmp = x + (y / (z * (-3.0d0)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -2.5e-73) {
		tmp = x + (y * (-0.3333333333333333 / z));
	} else if (y <= 3.7e-10) {
		tmp = (t / z) * (0.3333333333333333 / y);
	} else {
		tmp = x + (y / (z * -3.0));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -2.5e-73:
		tmp = x + (y * (-0.3333333333333333 / z))
	elif y <= 3.7e-10:
		tmp = (t / z) * (0.3333333333333333 / y)
	else:
		tmp = x + (y / (z * -3.0))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -2.5e-73)
		tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z)));
	elseif (y <= 3.7e-10)
		tmp = Float64(Float64(t / z) * Float64(0.3333333333333333 / y));
	else
		tmp = Float64(x + Float64(y / Float64(z * -3.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -2.5e-73)
		tmp = x + (y * (-0.3333333333333333 / z));
	elseif (y <= 3.7e-10)
		tmp = (t / z) * (0.3333333333333333 / y);
	else
		tmp = x + (y / (z * -3.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.5e-73], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.7e-10], N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{-73}:\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\

\mathbf{elif}\;y \leq 3.7 \cdot 10^{-10}:\\
\;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.4999999999999999e-73

    1. Initial program 96.3%

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

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

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

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

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

        \[\leadsto x + \color{blue}{y \cdot \frac{-0.3333333333333333}{z}} \]
    6. Simplified87.4%

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

    if -2.4999999999999999e-73 < y < 3.70000000000000015e-10

    1. Initial program 95.1%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{0.3333333333333333 \cdot \frac{t}{y}}}{z} \]
    7. Step-by-step derivation
      1. associate-*r/71.5%

        \[\leadsto \frac{\color{blue}{\frac{0.3333333333333333 \cdot t}{y}}}{z} \]
      2. *-commutative71.5%

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

        \[\leadsto \color{blue}{\frac{t \cdot 0.3333333333333333}{z \cdot y}} \]
      4. times-frac76.1%

        \[\leadsto \color{blue}{\frac{t}{z} \cdot \frac{0.3333333333333333}{y}} \]
    8. Applied egg-rr76.1%

      \[\leadsto \color{blue}{\frac{t}{z} \cdot \frac{0.3333333333333333}{y}} \]

    if 3.70000000000000015e-10 < y

    1. Initial program 97.1%

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

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

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

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

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

        \[\leadsto x + \color{blue}{y \cdot \frac{-0.3333333333333333}{z}} \]
    6. Simplified92.5%

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

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

        \[\leadsto x + \color{blue}{\frac{y}{\frac{z}{-0.3333333333333333}}} \]
      3. div-inv92.6%

        \[\leadsto x + \frac{y}{\color{blue}{z \cdot \frac{1}{-0.3333333333333333}}} \]
      4. metadata-eval92.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{-73}:\\ \;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{-10}:\\ \;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{z \cdot -3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 78.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.65 \cdot 10^{-75}:\\ \;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{-10}:\\ \;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{z \cdot -3}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -1.65e-75)
   (- x (* (/ y z) 0.3333333333333333))
   (if (<= y 3.7e-10)
     (* (/ t z) (/ 0.3333333333333333 y))
     (+ x (/ y (* z -3.0))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.65e-75) {
		tmp = x - ((y / z) * 0.3333333333333333);
	} else if (y <= 3.7e-10) {
		tmp = (t / z) * (0.3333333333333333 / y);
	} else {
		tmp = x + (y / (z * -3.0));
	}
	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 <= (-1.65d-75)) then
        tmp = x - ((y / z) * 0.3333333333333333d0)
    else if (y <= 3.7d-10) then
        tmp = (t / z) * (0.3333333333333333d0 / y)
    else
        tmp = x + (y / (z * (-3.0d0)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.65e-75) {
		tmp = x - ((y / z) * 0.3333333333333333);
	} else if (y <= 3.7e-10) {
		tmp = (t / z) * (0.3333333333333333 / y);
	} else {
		tmp = x + (y / (z * -3.0));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -1.65e-75:
		tmp = x - ((y / z) * 0.3333333333333333)
	elif y <= 3.7e-10:
		tmp = (t / z) * (0.3333333333333333 / y)
	else:
		tmp = x + (y / (z * -3.0))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -1.65e-75)
		tmp = Float64(x - Float64(Float64(y / z) * 0.3333333333333333));
	elseif (y <= 3.7e-10)
		tmp = Float64(Float64(t / z) * Float64(0.3333333333333333 / y));
	else
		tmp = Float64(x + Float64(y / Float64(z * -3.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -1.65e-75)
		tmp = x - ((y / z) * 0.3333333333333333);
	elseif (y <= 3.7e-10)
		tmp = (t / z) * (0.3333333333333333 / y);
	else
		tmp = x + (y / (z * -3.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.65e-75], N[(x - N[(N[(y / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.7e-10], N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{-75}:\\
\;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\

\mathbf{elif}\;y \leq 3.7 \cdot 10^{-10}:\\
\;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.65e-75

    1. Initial program 96.3%

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

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

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

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

      \[\leadsto \color{blue}{x - 0.3333333333333333 \cdot \frac{y}{z}} \]

    if -1.65e-75 < y < 3.70000000000000015e-10

    1. Initial program 95.1%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{0.3333333333333333 \cdot \frac{t}{y}}}{z} \]
    7. Step-by-step derivation
      1. associate-*r/71.5%

        \[\leadsto \frac{\color{blue}{\frac{0.3333333333333333 \cdot t}{y}}}{z} \]
      2. *-commutative71.5%

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

        \[\leadsto \color{blue}{\frac{t \cdot 0.3333333333333333}{z \cdot y}} \]
      4. times-frac76.1%

        \[\leadsto \color{blue}{\frac{t}{z} \cdot \frac{0.3333333333333333}{y}} \]
    8. Applied egg-rr76.1%

      \[\leadsto \color{blue}{\frac{t}{z} \cdot \frac{0.3333333333333333}{y}} \]

    if 3.70000000000000015e-10 < y

    1. Initial program 97.1%

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

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

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

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

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

        \[\leadsto x + \color{blue}{y \cdot \frac{-0.3333333333333333}{z}} \]
    6. Simplified92.5%

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

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

        \[\leadsto x + \color{blue}{\frac{y}{\frac{z}{-0.3333333333333333}}} \]
      3. div-inv92.6%

        \[\leadsto x + \frac{y}{\color{blue}{z \cdot \frac{1}{-0.3333333333333333}}} \]
      4. metadata-eval92.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.65 \cdot 10^{-75}:\\ \;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{-10}:\\ \;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{z \cdot -3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 46.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{+117}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+50}:\\ \;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -4.8e+117) x (if (<= z 3.2e+50) (* y (/ -0.3333333333333333 z)) x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -4.8e+117) {
		tmp = x;
	} else if (z <= 3.2e+50) {
		tmp = y * (-0.3333333333333333 / z);
	} 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 (z <= (-4.8d+117)) then
        tmp = x
    else if (z <= 3.2d+50) then
        tmp = y * ((-0.3333333333333333d0) / z)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -4.8e+117) {
		tmp = x;
	} else if (z <= 3.2e+50) {
		tmp = y * (-0.3333333333333333 / z);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -4.8e+117:
		tmp = x
	elif z <= 3.2e+50:
		tmp = y * (-0.3333333333333333 / z)
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -4.8e+117)
		tmp = x;
	elseif (z <= 3.2e+50)
		tmp = Float64(y * Float64(-0.3333333333333333 / z));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -4.8e+117)
		tmp = x;
	elseif (z <= 3.2e+50)
		tmp = y * (-0.3333333333333333 / z);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.8e+117], x, If[LessEqual[z, 3.2e+50], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+117}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 3.2 \cdot 10^{+50}:\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.7999999999999998e117 or 3.19999999999999983e50 < z

    1. Initial program 97.7%

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

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

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

    if -4.7999999999999998e117 < z < 3.19999999999999983e50

    1. Initial program 95.1%

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot \frac{t}{y} - 0.3333333333333333 \cdot y}{z}} \]
    6. Taylor expanded in t around 0 46.6%

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

        \[\leadsto \frac{\color{blue}{y \cdot -0.3333333333333333}}{z} \]
    8. Simplified46.6%

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

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

        \[\leadsto \color{blue}{\frac{-0.3333333333333333}{z} \cdot y} \]
    10. Applied egg-rr46.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{+117}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+50}:\\ \;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 95.4% accurate, 1.4× speedup?

\[\begin{array}{l} \\ x - \left(y - \frac{t}{y}\right) \cdot \frac{0.3333333333333333}{z} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (- x (* (- y (/ t y)) (/ 0.3333333333333333 z))))
double code(double x, double y, double z, double t) {
	return x - ((y - (t / y)) * (0.3333333333333333 / 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 - ((y - (t / y)) * (0.3333333333333333d0 / z))
end function
public static double code(double x, double y, double z, double t) {
	return x - ((y - (t / y)) * (0.3333333333333333 / z));
}
def code(x, y, z, t):
	return x - ((y - (t / y)) * (0.3333333333333333 / z))
function code(x, y, z, t)
	return Float64(x - Float64(Float64(y - Float64(t / y)) * Float64(0.3333333333333333 / z)))
end
function tmp = code(x, y, z, t)
	tmp = x - ((y - (t / y)) * (0.3333333333333333 / z));
end
code[x_, y_, z_, t_] := N[(x - N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

Alternative 17: 29.7% 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 96.1%

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

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification26.8%

    \[\leadsto x \]
  6. Add Preprocessing

Developer target: 96.0% 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 2024020 
(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))))