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

Percentage Accurate: 95.7% → 99.6%
Time: 12.4s
Alternatives: 15
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 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.7% 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: 99.6% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;z \cdot 3 \leq 5 \cdot 10^{-30}:\\
\;\;\;\;x - \frac{y - \frac{t}{y}}{z \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;t_1 + \frac{t}{y \cdot \left(z \cdot 3\right)}\\


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

    1. Initial program 99.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*99.7%

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

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

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

    if -1.9999999999999999e35 < (*.f64 z 3) < 4.99999999999999972e-30

    1. Initial program 91.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*91.5%

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
    3. Simplified91.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. associate-+l-91.5%

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

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

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

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

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

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

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

    if 4.99999999999999972e-30 < (*.f64 z 3)

    1. Initial program 99.8%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Add Preprocessing
  3. Recombined 3 regimes into one program.
  4. Final simplification99.8%

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

Alternative 2: 99.6% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq -2 \cdot 10^{+35} \lor \neg \left(z \cdot 3 \leq 5 \cdot 10^{-30}\right):\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \left(y \cdot 3\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z 3) < -1.9999999999999999e35 or 4.99999999999999972e-30 < (*.f64 z 3)

    1. Initial program 99.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*99.7%

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

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

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

    if -1.9999999999999999e35 < (*.f64 z 3) < 4.99999999999999972e-30

    1. Initial program 91.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*91.5%

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
    3. Simplified91.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. associate-+l-91.5%

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

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

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

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

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

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

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

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

Alternative 3: 88.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := x + t \cdot \frac{\frac{0.3333333333333333}{z}}{y}\\
\mathbf{if}\;y \leq -530000000000:\\
\;\;\;\;x - 0.3333333333333333 \cdot \frac{y}{z}\\

\mathbf{elif}\;y \leq 5.2 \cdot 10^{-165}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 1.16 \cdot 10^{-110}:\\
\;\;\;\;\frac{0.3333333333333333}{z} \cdot \left(\frac{t}{y} - y\right)\\

\mathbf{elif}\;y \leq 3.1 \cdot 10^{+28}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -5.3e11

    1. Initial program 98.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*98.2%

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
    3. Simplified98.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 t around 0 95.6%

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

    if -5.3e11 < y < 5.20000000000000015e-165 or 1.16000000000000001e-110 < y < 3.1000000000000001e28

    1. Initial program 95.6%

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

      \[\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 92.3%

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

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

        \[\leadsto x + \frac{t}{y \cdot z} \cdot \color{blue}{\frac{1}{3}} \]
      3. times-frac92.4%

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

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

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

        \[\leadsto x + \frac{t}{3} \cdot \color{blue}{\frac{\frac{1}{y}}{z}} \]
      7. times-frac86.3%

        \[\leadsto x + \color{blue}{\frac{t \cdot \frac{1}{y}}{3 \cdot z}} \]
      8. *-commutative86.3%

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

        \[\leadsto x + \color{blue}{t \cdot \frac{\frac{1}{y}}{z \cdot 3}} \]
      10. associate-/l/92.3%

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

        \[\leadsto x + t \cdot \color{blue}{\frac{\frac{1}{z \cdot 3}}{y}} \]
      12. *-commutative92.3%

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

        \[\leadsto x + t \cdot \frac{\color{blue}{\frac{\frac{1}{3}}{z}}}{y} \]
      14. metadata-eval92.2%

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

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

    if 5.20000000000000015e-165 < y < 1.16000000000000001e-110

    1. Initial program 63.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*63.4%

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

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

      \[\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. +-commutative63.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\frac{t}{y} - y\right) \cdot \frac{0.3333333333333333}{z}} \]
    9. Simplified88.1%

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

    if 3.1000000000000001e28 < y

    1. Initial program 99.9%

      \[\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 96.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -530000000000:\\ \;\;\;\;x - 0.3333333333333333 \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-165}:\\ \;\;\;\;x + t \cdot \frac{\frac{0.3333333333333333}{z}}{y}\\ \mathbf{elif}\;y \leq 1.16 \cdot 10^{-110}:\\ \;\;\;\;\frac{0.3333333333333333}{z} \cdot \left(\frac{t}{y} - y\right)\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{+28}:\\ \;\;\;\;x + t \cdot \frac{\frac{0.3333333333333333}{z}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 81.7% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;z \cdot 3 \leq 2 \cdot 10^{+20}:\\
\;\;\;\;\frac{0.3333333333333333}{z} \cdot \left(\frac{t}{y} - y\right)\\

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

    if -1.00000000000000006e63 < (*.f64 z 3) < 2e20

    1. Initial program 92.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*92.3%

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
    3. Simplified92.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. Step-by-step derivation
      1. +-commutative92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.3333333333333333}{z} \cdot \left(\frac{t}{y} - y\right)} \]
      3. *-commutative91.6%

        \[\leadsto \color{blue}{\left(\frac{t}{y} - y\right) \cdot \frac{0.3333333333333333}{z}} \]
    9. Simplified91.6%

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

    if 2e20 < (*.f64 z 3)

    1. Initial program 99.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*99.8%

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
    3. Simplified99.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 t around 0 74.4%

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

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

Alternative 5: 96.9% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 7.5000000000000003e-174

    1. Initial program 96.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*96.1%

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

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

      \[\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. +-commutative96.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.5000000000000003e-174 < y

    1. Initial program 95.2%

      \[\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. Step-by-step derivation
      1. associate-+l-95.2%

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

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

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

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

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

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

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

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

Alternative 6: 93.2% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -50000000000:\\
\;\;\;\;x - 0.3333333333333333 \cdot \frac{y}{z}\\

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

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


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

    1. Initial program 98.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*98.2%

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
    3. Simplified98.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 t around 0 95.6%

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

    if -5e10 < y < 2.9e22

    1. Initial program 92.2%

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

      \[\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 88.4%

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

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

        \[\leadsto x + \frac{t}{y \cdot z} \cdot \color{blue}{\frac{1}{3}} \]
      3. times-frac88.5%

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

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

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

        \[\leadsto x + \frac{t}{3} \cdot \color{blue}{\frac{\frac{1}{y}}{z}} \]
      7. times-frac86.2%

        \[\leadsto x + \color{blue}{\frac{t \cdot \frac{1}{y}}{3 \cdot z}} \]
      8. *-commutative86.2%

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

        \[\leadsto x + \color{blue}{t \cdot \frac{\frac{1}{y}}{z \cdot 3}} \]
      10. associate-/l/88.5%

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

        \[\leadsto x + t \cdot \color{blue}{\frac{\frac{1}{z \cdot 3}}{y}} \]
      12. *-commutative88.4%

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

        \[\leadsto x + t \cdot \frac{\color{blue}{\frac{\frac{1}{3}}{z}}}{y} \]
      14. metadata-eval88.4%

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

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

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

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

    if 2.9e22 < y

    1. Initial program 99.9%

      \[\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 96.7%

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

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

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

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

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

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

Alternative 7: 59.4% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -57000:\\
\;\;\;\;\frac{y \cdot -0.3333333333333333}{z}\\

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

\mathbf{elif}\;y \leq 3.2 \cdot 10^{+160}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -57000

    1. Initial program 98.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*98.3%

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
    3. Simplified98.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. Step-by-step derivation
      1. +-commutative98.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -57000 < y < 5.50000000000000031e-121

    1. Initial program 91.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*91.3%

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
    3. Simplified91.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 z around 0 66.7%

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

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{0.3333333333333333 \cdot \frac{t}{y} - 0.3333333333333333 \cdot y}}} \]
      2. inv-pow66.7%

        \[\leadsto \color{blue}{{\left(\frac{z}{0.3333333333333333 \cdot \frac{t}{y} - 0.3333333333333333 \cdot y}\right)}^{-1}} \]
      3. *-un-lft-identity66.7%

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

        \[\leadsto {\left(\frac{1 \cdot z}{\color{blue}{0.3333333333333333 \cdot \left(\frac{t}{y} - y\right)}}\right)}^{-1} \]
      5. times-frac66.8%

        \[\leadsto {\color{blue}{\left(\frac{1}{0.3333333333333333} \cdot \frac{z}{\frac{t}{y} - y}\right)}}^{-1} \]
      6. metadata-eval66.8%

        \[\leadsto {\left(\color{blue}{3} \cdot \frac{z}{\frac{t}{y} - y}\right)}^{-1} \]
    7. Applied egg-rr66.8%

      \[\leadsto \color{blue}{{\left(3 \cdot \frac{z}{\frac{t}{y} - y}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. unpow-166.8%

        \[\leadsto \color{blue}{\frac{1}{3 \cdot \frac{z}{\frac{t}{y} - y}}} \]
    9. Simplified66.8%

      \[\leadsto \color{blue}{\frac{1}{3 \cdot \frac{z}{\frac{t}{y} - y}}} \]
    10. Taylor expanded in t around inf 67.6%

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

        \[\leadsto 0.3333333333333333 \cdot \frac{t}{\color{blue}{z \cdot y}} \]
    12. Simplified67.6%

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

    if 5.50000000000000031e-121 < y < 3.1999999999999998e160

    1. Initial program 97.6%

      \[\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 54.7%

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

    if 3.1999999999999998e160 < y

    1. Initial program 99.9%

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

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
    3. Simplified99.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. Step-by-step derivation
      1. +-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.3333333333333333}{z} \cdot y} \]
      3. metadata-eval82.5%

        \[\leadsto \frac{\color{blue}{-0.3333333333333333}}{z} \cdot y \]
      4. distribute-neg-frac82.5%

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

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

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

        \[\leadsto y \cdot \frac{\color{blue}{-0.3333333333333333}}{z} \]
    9. Simplified82.5%

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

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

Alternative 8: 76.8% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-52} \lor \neg \left(y \leq 2.8 \cdot 10^{-121}\right):\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.9000000000000002e-52 or 2.8000000000000001e-121 < y

    1. Initial program 98.6%

      \[\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 90.1%

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

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

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

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

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

    if -2.9000000000000002e-52 < y < 2.8000000000000001e-121

    1. Initial program 91.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*91.1%

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

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

      \[\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 67.1%

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

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{0.3333333333333333 \cdot \frac{t}{y} - 0.3333333333333333 \cdot y}}} \]
      2. inv-pow67.0%

        \[\leadsto \color{blue}{{\left(\frac{z}{0.3333333333333333 \cdot \frac{t}{y} - 0.3333333333333333 \cdot y}\right)}^{-1}} \]
      3. *-un-lft-identity67.0%

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

        \[\leadsto {\left(\frac{1 \cdot z}{\color{blue}{0.3333333333333333 \cdot \left(\frac{t}{y} - y\right)}}\right)}^{-1} \]
      5. times-frac67.1%

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

        \[\leadsto {\left(\color{blue}{3} \cdot \frac{z}{\frac{t}{y} - y}\right)}^{-1} \]
    7. Applied egg-rr67.1%

      \[\leadsto \color{blue}{{\left(3 \cdot \frac{z}{\frac{t}{y} - y}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. unpow-167.1%

        \[\leadsto \color{blue}{\frac{1}{3 \cdot \frac{z}{\frac{t}{y} - y}}} \]
    9. Simplified67.1%

      \[\leadsto \color{blue}{\frac{1}{3 \cdot \frac{z}{\frac{t}{y} - y}}} \]
    10. Taylor expanded in t around inf 68.0%

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

        \[\leadsto 0.3333333333333333 \cdot \frac{t}{\color{blue}{z \cdot y}} \]
    12. Simplified68.0%

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

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

Alternative 9: 76.6% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 98.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*98.3%

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
    3. Simplified98.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 94.3%

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

    if -2.4000000000000001e-32 < y < 7e-114

    1. Initial program 91.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*91.1%

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

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

      \[\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 67.1%

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

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{0.3333333333333333 \cdot \frac{t}{y} - 0.3333333333333333 \cdot y}}} \]
      2. inv-pow67.0%

        \[\leadsto \color{blue}{{\left(\frac{z}{0.3333333333333333 \cdot \frac{t}{y} - 0.3333333333333333 \cdot y}\right)}^{-1}} \]
      3. *-un-lft-identity67.0%

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

        \[\leadsto {\left(\frac{1 \cdot z}{\color{blue}{0.3333333333333333 \cdot \left(\frac{t}{y} - y\right)}}\right)}^{-1} \]
      5. times-frac67.1%

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

        \[\leadsto {\left(\color{blue}{3} \cdot \frac{z}{\frac{t}{y} - y}\right)}^{-1} \]
    7. Applied egg-rr67.1%

      \[\leadsto \color{blue}{{\left(3 \cdot \frac{z}{\frac{t}{y} - y}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. unpow-167.1%

        \[\leadsto \color{blue}{\frac{1}{3 \cdot \frac{z}{\frac{t}{y} - y}}} \]
    9. Simplified67.1%

      \[\leadsto \color{blue}{\frac{1}{3 \cdot \frac{z}{\frac{t}{y} - y}}} \]
    10. Taylor expanded in t around inf 68.0%

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

        \[\leadsto 0.3333333333333333 \cdot \frac{t}{\color{blue}{z \cdot y}} \]
    12. Simplified68.0%

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

    if 7e-114 < y

    1. Initial program 98.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 t around 0 86.7%

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

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

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

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

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

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

Alternative 10: 95.8% accurate, 1.4× speedup?

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

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

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

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

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

Alternative 11: 95.9% accurate, 1.4× speedup?

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

\\
x - \frac{y - \frac{t}{y}}{z \cdot 3}
\end{array}
Derivation
  1. Initial program 95.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*95.7%

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
  3. Simplified95.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. Step-by-step derivation
    1. associate-+l-95.7%

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

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

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

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

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

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

    \[\leadsto \color{blue}{x - \frac{y - \frac{t}{y}}{z \cdot 3}} \]
  7. Final simplification95.4%

    \[\leadsto x - \frac{y - \frac{t}{y}}{z \cdot 3} \]
  8. Add Preprocessing

Alternative 12: 48.2% accurate, 1.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.49999999999999991e93 or 7.8000000000000001e114 < x

    1. Initial program 98.8%

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

      \[\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 61.4%

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

    if -4.49999999999999991e93 < x < 7.8000000000000001e114

    1. Initial program 94.2%

      \[\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.2%

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
    3. Simplified94.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. Step-by-step derivation
      1. +-commutative94.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+93}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7.8 \cdot 10^{+114}:\\ \;\;\;\;\frac{y}{z} \cdot -0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 48.2% accurate, 1.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.5000000000000003e93 or 2.25e114 < x

    1. Initial program 98.8%

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

      \[\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 61.4%

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

    if -5.5000000000000003e93 < x < 2.25e114

    1. Initial program 94.2%

      \[\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.2%

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
    3. Simplified94.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. Step-by-step derivation
      1. +-commutative94.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.3333333333333333}{z} \cdot y} \]
      3. metadata-eval49.5%

        \[\leadsto \frac{\color{blue}{-0.3333333333333333}}{z} \cdot y \]
      4. distribute-neg-frac49.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{+93}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{+114}:\\ \;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 48.2% accurate, 1.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.7999999999999996e92 or 2.9e114 < x

    1. Initial program 98.8%

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

      \[\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 61.4%

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

    if -6.7999999999999996e92 < x < 2.9e114

    1. Initial program 94.2%

      \[\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.2%

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

        \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \color{blue}{\left(y \cdot 3\right)}} \]
    3. Simplified94.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. Step-by-step derivation
      1. +-commutative94.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.8 \cdot 10^{+92}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.9 \cdot 10^{+114}:\\ \;\;\;\;\frac{y \cdot -0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 31.0% accurate, 29.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 95.7%

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

    \[\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 30.1%

    \[\leadsto \color{blue}{x} \]
  5. Final simplification30.1%

    \[\leadsto x \]
  6. Add Preprocessing

Developer target: 96.4% 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 2024011 
(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))))