Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B

Percentage Accurate: 77.1% → 89.2%
Time: 9.9s
Alternatives: 7
Speedup: 0.8×

Specification

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

\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\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 7 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: 77.1% accurate, 1.0× speedup?

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

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

Alternative 1: 89.2% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{+28} \lor \neg \left(t \leq 2.75 \cdot 10^{+17}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\

\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + \frac{t - z}{\frac{a - t}{y}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.6000000000000002e28 or 2.75e17 < t

    1. Initial program 60.5%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{z - t}{a - t} \cdot y\right)} + \left(x + y\right) \]
      7. distribute-lft-neg-in68.2%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-\left(z - t\right)}{a - t}, y, x + y\right)} \]
      10. sub-neg68.2%

        \[\leadsto \mathsf{fma}\left(\frac{-\color{blue}{\left(z + \left(-t\right)\right)}}{a - t}, y, x + y\right) \]
      11. distribute-neg-in68.2%

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\left(-z\right) + \left(-\left(-t\right)\right)}}{a - t}, y, x + y\right) \]
      12. remove-double-neg68.2%

        \[\leadsto \mathsf{fma}\left(\frac{\left(-z\right) + \color{blue}{t}}{a - t}, y, x + y\right) \]
      13. +-commutative68.2%

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{t + \left(-z\right)}}{a - t}, y, x + y\right) \]
      14. sub-neg68.2%

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{t - z}}{a - t}, y, x + y\right) \]
    3. Simplified68.2%

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

      \[\leadsto \color{blue}{x + \left(y + \left(-1 \cdot y + \frac{y \cdot \left(z - a\right)}{t}\right)\right)} \]
    6. Step-by-step derivation
      1. associate-+r+85.4%

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

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

        \[\leadsto x + \left(\color{blue}{0} \cdot y + \frac{y \cdot \left(z - a\right)}{t}\right) \]
      4. mul0-lft85.4%

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

        \[\leadsto x + \left(0 + \color{blue}{\frac{y}{\frac{t}{z - a}}}\right) \]
    7. Simplified94.2%

      \[\leadsto \color{blue}{x + \left(0 + \frac{y}{\frac{t}{z - a}}\right)} \]

    if -2.6000000000000002e28 < t < 2.75e17

    1. Initial program 91.8%

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

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

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

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

      \[\leadsto \left(x + y\right) - \color{blue}{\frac{z - t}{\frac{a - t}{y}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.3%

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

Alternative 2: 89.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.25 \cdot 10^{+27} \lor \neg \left(t \leq 2.6 \cdot 10^{+17}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\

\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + \frac{y}{a - t} \cdot \left(t - z\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.25e27 or 2.6e17 < t

    1. Initial program 60.5%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{z - t}{a - t} \cdot y\right)} + \left(x + y\right) \]
      7. distribute-lft-neg-in68.2%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-\left(z - t\right)}{a - t}, y, x + y\right)} \]
      10. sub-neg68.2%

        \[\leadsto \mathsf{fma}\left(\frac{-\color{blue}{\left(z + \left(-t\right)\right)}}{a - t}, y, x + y\right) \]
      11. distribute-neg-in68.2%

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\left(-z\right) + \left(-\left(-t\right)\right)}}{a - t}, y, x + y\right) \]
      12. remove-double-neg68.2%

        \[\leadsto \mathsf{fma}\left(\frac{\left(-z\right) + \color{blue}{t}}{a - t}, y, x + y\right) \]
      13. +-commutative68.2%

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{t + \left(-z\right)}}{a - t}, y, x + y\right) \]
      14. sub-neg68.2%

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{t - z}}{a - t}, y, x + y\right) \]
    3. Simplified68.2%

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

      \[\leadsto \color{blue}{x + \left(y + \left(-1 \cdot y + \frac{y \cdot \left(z - a\right)}{t}\right)\right)} \]
    6. Step-by-step derivation
      1. associate-+r+85.4%

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

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

        \[\leadsto x + \left(\color{blue}{0} \cdot y + \frac{y \cdot \left(z - a\right)}{t}\right) \]
      4. mul0-lft85.4%

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

        \[\leadsto x + \left(0 + \color{blue}{\frac{y}{\frac{t}{z - a}}}\right) \]
    7. Simplified94.2%

      \[\leadsto \color{blue}{x + \left(0 + \frac{y}{\frac{t}{z - a}}\right)} \]

    if -2.25e27 < t < 2.6e17

    1. Initial program 91.8%

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

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

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

      \[\leadsto \left(x + y\right) - \color{blue}{\frac{y \cdot \left(z - t\right)}{a - t}} \]
    6. Step-by-step derivation
      1. *-commutative91.8%

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

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

      \[\leadsto \left(x + y\right) - \color{blue}{\left(z - t\right) \cdot \frac{y}{a - t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.3%

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

Alternative 3: 79.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9 \cdot 10^{+60} \lor \neg \left(a \leq 1.3 \cdot 10^{+119}\right):\\
\;\;\;\;\left(x + y\right) - z \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.90000000000000005e60 or 1.3e119 < a

    1. Initial program 89.0%

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

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

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

      \[\leadsto \color{blue}{\left(x + y\right) - \frac{y \cdot z}{a}} \]
    6. Step-by-step derivation
      1. associate-/l*91.1%

        \[\leadsto \left(x + y\right) - \color{blue}{\frac{y}{\frac{a}{z}}} \]
      2. associate-/r/92.4%

        \[\leadsto \left(x + y\right) - \color{blue}{\frac{y}{a} \cdot z} \]
    7. Applied egg-rr92.4%

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

    if -1.90000000000000005e60 < a < 1.3e119

    1. Initial program 71.3%

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

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

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

      \[\leadsto \left(x + y\right) - \color{blue}{\frac{y \cdot \left(z - t\right)}{a - t}} \]
    6. Step-by-step derivation
      1. *-commutative71.3%

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

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

      \[\leadsto \left(x + y\right) - \color{blue}{\left(z - t\right) \cdot \frac{y}{a - t}} \]
    8. Taylor expanded in t around inf 80.7%

      \[\leadsto \color{blue}{\left(x + -1 \cdot \frac{a \cdot y}{t}\right) - -1 \cdot \frac{y \cdot z}{t}} \]
    9. Step-by-step derivation
      1. associate--l+80.7%

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

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

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

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

        \[\leadsto \color{blue}{x - \frac{a \cdot y - y \cdot z}{t}} \]
      6. *-commutative81.3%

        \[\leadsto x - \frac{\color{blue}{y \cdot a} - y \cdot z}{t} \]
      7. distribute-lft-out--81.3%

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

      \[\leadsto \color{blue}{x - \frac{y \cdot \left(a - z\right)}{t}} \]
    11. Taylor expanded in a around 0 80.5%

      \[\leadsto \color{blue}{x - -1 \cdot \frac{y \cdot z}{t}} \]
    12. Step-by-step derivation
      1. sub-neg80.5%

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

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

        \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
      4. +-commutative80.5%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{t}{z}}} + x \]
    13. Simplified82.7%

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

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

Alternative 4: 82.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -45000000000000 \lor \neg \left(t \leq 1.5 \cdot 10^{+14}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z - a}}\\

\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - z \cdot \frac{y}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.5e13 or 1.5e14 < t

    1. Initial program 62.1%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{z - t}{a - t} \cdot y\right)} + \left(x + y\right) \]
      7. distribute-lft-neg-in69.5%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-\left(z - t\right)}{a - t}, y, x + y\right)} \]
      10. sub-neg69.5%

        \[\leadsto \mathsf{fma}\left(\frac{-\color{blue}{\left(z + \left(-t\right)\right)}}{a - t}, y, x + y\right) \]
      11. distribute-neg-in69.5%

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\left(-z\right) + \left(-\left(-t\right)\right)}}{a - t}, y, x + y\right) \]
      12. remove-double-neg69.5%

        \[\leadsto \mathsf{fma}\left(\frac{\left(-z\right) + \color{blue}{t}}{a - t}, y, x + y\right) \]
      13. +-commutative69.5%

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{t + \left(-z\right)}}{a - t}, y, x + y\right) \]
      14. sub-neg69.5%

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{t - z}}{a - t}, y, x + y\right) \]
    3. Simplified69.5%

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

      \[\leadsto \color{blue}{x + \left(y + \left(-1 \cdot y + \frac{y \cdot \left(z - a\right)}{t}\right)\right)} \]
    6. Step-by-step derivation
      1. associate-+r+86.0%

        \[\leadsto x + \color{blue}{\left(\left(y + -1 \cdot y\right) + \frac{y \cdot \left(z - a\right)}{t}\right)} \]
      2. distribute-rgt1-in86.0%

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

        \[\leadsto x + \left(\color{blue}{0} \cdot y + \frac{y \cdot \left(z - a\right)}{t}\right) \]
      4. mul0-lft86.0%

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

        \[\leadsto x + \left(0 + \color{blue}{\frac{y}{\frac{t}{z - a}}}\right) \]
    7. Simplified94.4%

      \[\leadsto \color{blue}{x + \left(0 + \frac{y}{\frac{t}{z - a}}\right)} \]

    if -4.5e13 < t < 1.5e14

    1. Initial program 91.4%

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

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

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

      \[\leadsto \color{blue}{\left(x + y\right) - \frac{y \cdot z}{a}} \]
    6. Step-by-step derivation
      1. associate-/l*80.6%

        \[\leadsto \left(x + y\right) - \color{blue}{\frac{y}{\frac{a}{z}}} \]
      2. associate-/r/81.6%

        \[\leadsto \left(x + y\right) - \color{blue}{\frac{y}{a} \cdot z} \]
    7. Applied egg-rr81.6%

      \[\leadsto \left(x + y\right) - \color{blue}{\frac{y}{a} \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.7%

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

Alternative 5: 77.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{+72} \lor \neg \left(a \leq 1.3 \cdot 10^{+119}\right):\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -6.5000000000000001e72 or 1.3e119 < a

    1. Initial program 89.6%

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

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

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

      \[\leadsto \color{blue}{x + y} \]
    6. Step-by-step derivation
      1. +-commutative87.6%

        \[\leadsto \color{blue}{y + x} \]
    7. Simplified87.6%

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

    if -6.5000000000000001e72 < a < 1.3e119

    1. Initial program 71.4%

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

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

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

      \[\leadsto \left(x + y\right) - \color{blue}{\frac{y \cdot \left(z - t\right)}{a - t}} \]
    6. Step-by-step derivation
      1. *-commutative71.4%

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

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

      \[\leadsto \left(x + y\right) - \color{blue}{\left(z - t\right) \cdot \frac{y}{a - t}} \]
    8. Taylor expanded in t around inf 80.0%

      \[\leadsto \color{blue}{\left(x + -1 \cdot \frac{a \cdot y}{t}\right) - -1 \cdot \frac{y \cdot z}{t}} \]
    9. Step-by-step derivation
      1. associate--l+80.0%

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

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

        \[\leadsto x + -1 \cdot \color{blue}{\frac{a \cdot y - y \cdot z}{t}} \]
      4. mul-1-neg80.6%

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

        \[\leadsto \color{blue}{x - \frac{a \cdot y - y \cdot z}{t}} \]
      6. *-commutative80.6%

        \[\leadsto x - \frac{\color{blue}{y \cdot a} - y \cdot z}{t} \]
      7. distribute-lft-out--80.6%

        \[\leadsto x - \frac{\color{blue}{y \cdot \left(a - z\right)}}{t} \]
    10. Simplified80.6%

      \[\leadsto \color{blue}{x - \frac{y \cdot \left(a - z\right)}{t}} \]
    11. Taylor expanded in a around 0 79.9%

      \[\leadsto \color{blue}{x - -1 \cdot \frac{y \cdot z}{t}} \]
    12. Step-by-step derivation
      1. sub-neg79.9%

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

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

        \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
      4. +-commutative79.9%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{t}{z}}} + x \]
    13. Simplified82.0%

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

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

Alternative 6: 62.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+28}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq 1.1 \cdot 10^{+68}:\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -9.99999999999999958e27 or 1.09999999999999994e68 < t

    1. Initial program 59.8%

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

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

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

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

    if -9.99999999999999958e27 < t < 1.09999999999999994e68

    1. Initial program 90.3%

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

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

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

      \[\leadsto \color{blue}{x + y} \]
    6. Step-by-step derivation
      1. +-commutative65.2%

        \[\leadsto \color{blue}{y + x} \]
    7. Simplified65.2%

      \[\leadsto \color{blue}{y + x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification68.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1 \cdot 10^{+28}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 1.1 \cdot 10^{+68}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 51.5% accurate, 13.0× speedup?

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

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

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

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

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

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

    \[\leadsto x \]
  7. Add Preprocessing

Developer target: 88.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\ t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\ \mathbf{if}\;t\_2 < -1.3664970889390727 \cdot 10^{-7}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 < 1.4754293444577233 \cdot 10^{-239}:\\ \;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)))
        (t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
   (if (< t_2 -1.3664970889390727e-7)
     t_1
     (if (< t_2 1.4754293444577233e-239)
       (/ (- (* y (- a z)) (* x t)) (- a t))
       t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
	double t_2 = (x + y) - (((z - t) * y) / (a - t));
	double tmp;
	if (t_2 < -1.3664970889390727e-7) {
		tmp = t_1;
	} else if (t_2 < 1.4754293444577233e-239) {
		tmp = ((y * (a - z)) - (x * t)) / (a - t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (y + x) - (((z - t) * (1.0d0 / (a - t))) * y)
    t_2 = (x + y) - (((z - t) * y) / (a - t))
    if (t_2 < (-1.3664970889390727d-7)) then
        tmp = t_1
    else if (t_2 < 1.4754293444577233d-239) then
        tmp = ((y * (a - z)) - (x * t)) / (a - t)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
	double t_2 = (x + y) - (((z - t) * y) / (a - t));
	double tmp;
	if (t_2 < -1.3664970889390727e-7) {
		tmp = t_1;
	} else if (t_2 < 1.4754293444577233e-239) {
		tmp = ((y * (a - z)) - (x * t)) / (a - t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y)
	t_2 = (x + y) - (((z - t) * y) / (a - t))
	tmp = 0
	if t_2 < -1.3664970889390727e-7:
		tmp = t_1
	elif t_2 < 1.4754293444577233e-239:
		tmp = ((y * (a - z)) - (x * t)) / (a - t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(y + x) - Float64(Float64(Float64(z - t) * Float64(1.0 / Float64(a - t))) * y))
	t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t)))
	tmp = 0.0
	if (t_2 < -1.3664970889390727e-7)
		tmp = t_1;
	elseif (t_2 < 1.4754293444577233e-239)
		tmp = Float64(Float64(Float64(y * Float64(a - z)) - Float64(x * t)) / Float64(a - t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
	t_2 = (x + y) - (((z - t) * y) / (a - t));
	tmp = 0.0;
	if (t_2 < -1.3664970889390727e-7)
		tmp = t_1;
	elseif (t_2 < 1.4754293444577233e-239)
		tmp = ((y * (a - z)) - (x * t)) / (a - t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -1.3664970889390727e-7], t$95$1, If[Less[t$95$2, 1.4754293444577233e-239], N[(N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(x * t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_2 < -1.3664970889390727 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 < 1.4754293444577233 \cdot 10^{-239}:\\
\;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024027 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
  :precision binary64

  :herbie-target
  (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-7) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y))))

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