Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A

Percentage Accurate: 98.2% → 98.8%
Time: 10.1s
Alternatives: 13
Speedup: 1.0×

Specification

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

\\
x + y \cdot \frac{z - t}{z - a}
\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 13 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: 98.2% accurate, 1.0× speedup?

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

\\
x + y \cdot \frac{z - t}{z - a}
\end{array}

Alternative 1: 98.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq 10^{+308}:\\
\;\;\;\;x + t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a))) < 1e308

    1. Initial program 98.7%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing

    if 1e308 < (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a)))

    1. Initial program 67.0%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Step-by-step derivation
      1. associate-*r/100.0%

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

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

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

        \[\leadsto x + \frac{\color{blue}{-t \cdot y}}{z - a} \]
      2. distribute-lft-neg-out100.0%

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

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

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

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

Alternative 2: 81.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+46} \lor \neg \left(z \leq 5.2 \cdot 10^{-46}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.8000000000000004e46 or 5.2000000000000004e-46 < z

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 67.8%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{z}} \]
      2. div-sub88.2%

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

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

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

    if -5.8000000000000004e46 < z < 5.2000000000000004e-46

    1. Initial program 93.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 70.6%

      \[\leadsto \color{blue}{x + \frac{t \cdot y}{a}} \]
    4. Step-by-step derivation
      1. +-commutative70.6%

        \[\leadsto \color{blue}{\frac{t \cdot y}{a} + x} \]
      2. associate-/l*74.2%

        \[\leadsto \color{blue}{t \cdot \frac{y}{a}} + x \]
    5. Simplified74.2%

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

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

Alternative 3: 80.2% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.9 \cdot 10^{+40}:\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -6.9000000000000003e40

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.9%

        \[\leadsto x + y \cdot \color{blue}{\frac{1}{\frac{z - a}{z - t}}} \]
      2. un-div-inv100.0%

        \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}} \]
    4. Applied egg-rr100.0%

      \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}} \]
    5. Taylor expanded in t around 0 87.7%

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

    if -6.9000000000000003e40 < a < 2.95e10

    1. Initial program 94.8%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 85.2%

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

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

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

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

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

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

        \[\leadsto x + \frac{\color{blue}{z - t}}{\frac{z - a}{y}} \]
    5. Simplified97.2%

      \[\leadsto x + \color{blue}{\frac{z - t}{\frac{z - a}{y}}} \]
    6. Taylor expanded in z around inf 83.5%

      \[\leadsto x + \frac{z - t}{\color{blue}{\frac{z}{y}}} \]
    7. Taylor expanded in z around inf 79.8%

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

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

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

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

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

    if 2.95e10 < a

    1. Initial program 99.8%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.7%

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

        \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}} \]
    4. Applied egg-rr99.8%

      \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}} \]
    5. Taylor expanded in z around 0 75.9%

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

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

Alternative 4: 81.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.46 \cdot 10^{+41}:\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.4600000000000001e41

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.9%

        \[\leadsto x + y \cdot \color{blue}{\frac{1}{\frac{z - a}{z - t}}} \]
      2. un-div-inv100.0%

        \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}} \]
    4. Applied egg-rr100.0%

      \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}} \]
    5. Taylor expanded in t around 0 87.7%

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

    if -1.4600000000000001e41 < a < 5e6

    1. Initial program 94.8%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 85.2%

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

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

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

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

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

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

        \[\leadsto x + \frac{\color{blue}{z - t}}{\frac{z - a}{y}} \]
    5. Simplified97.2%

      \[\leadsto x + \color{blue}{\frac{z - t}{\frac{z - a}{y}}} \]
    6. Taylor expanded in z around inf 83.5%

      \[\leadsto x + \frac{z - t}{\color{blue}{\frac{z}{y}}} \]
    7. Taylor expanded in z around inf 79.8%

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

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

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

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

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

    if 5e6 < a

    1. Initial program 99.8%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in a around inf 70.7%

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

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

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

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

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

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

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

Alternative 5: 87.8% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;z \leq 1.05 \cdot 10^{+15}:\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.20000000000000027e46

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 71.4%

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

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

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

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

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

    if -5.20000000000000027e46 < z < 1.05e15

    1. Initial program 94.4%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 87.3%

      \[\leadsto x + \color{blue}{-1 \cdot \frac{t \cdot y}{z - a}} \]
    4. Step-by-step derivation
      1. mul-1-neg87.3%

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

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

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

    if 1.05e15 < z

    1. Initial program 99.8%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num99.8%

        \[\leadsto x + y \cdot \color{blue}{\frac{1}{\frac{z - a}{z - t}}} \]
      2. un-div-inv99.9%

        \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}} \]
    4. Applied egg-rr99.9%

      \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}} \]
    5. Taylor expanded in t around 0 85.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{+46}:\\ \;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{+15}:\\ \;\;\;\;x + t \cdot \frac{y}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 61.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{-265}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;z \leq 3.8 \cdot 10^{-292}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\

\mathbf{elif}\;z \leq 4.1 \cdot 10^{-240}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.05000000000000002e-265 or 4.1000000000000001e-240 < z

    1. Initial program 97.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 65.0%

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

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified65.0%

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

    if -1.05000000000000002e-265 < z < 3.8000000000000002e-292

    1. Initial program 79.4%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 89.5%

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

        \[\leadsto \color{blue}{\frac{t \cdot y}{a} + x} \]
      2. associate-/l*99.8%

        \[\leadsto \color{blue}{t \cdot \frac{y}{a}} + x \]
    5. Simplified99.8%

      \[\leadsto \color{blue}{t \cdot \frac{y}{a} + x} \]
    6. Taylor expanded in y around inf 79.4%

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

        \[\leadsto y \cdot \color{blue}{\left(\frac{x}{y} + \frac{t}{a}\right)} \]
    8. Simplified79.4%

      \[\leadsto \color{blue}{y \cdot \left(\frac{x}{y} + \frac{t}{a}\right)} \]
    9. Taylor expanded in x around 0 69.1%

      \[\leadsto y \cdot \color{blue}{\frac{t}{a}} \]
    10. Step-by-step derivation
      1. *-commutative69.1%

        \[\leadsto \color{blue}{\frac{t}{a} \cdot y} \]
      2. associate-/r/89.5%

        \[\leadsto \color{blue}{\frac{t}{\frac{a}{y}}} \]
    11. Applied egg-rr89.5%

      \[\leadsto \color{blue}{\frac{t}{\frac{a}{y}}} \]

    if 3.8000000000000002e-292 < z < 4.1000000000000001e-240

    1. Initial program 91.6%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 73.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{-265}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{-292}:\\ \;\;\;\;\frac{t}{\frac{a}{y}}\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{-240}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 76.2% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+46} \lor \neg \left(z \leq 1.05 \cdot 10^{-43}\right):\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.20000000000000027e46 or 1.05e-43 < z

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 80.3%

      \[\leadsto \color{blue}{x + y} \]
    4. Step-by-step derivation
      1. +-commutative80.3%

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified80.3%

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

    if -5.20000000000000027e46 < z < 1.05e-43

    1. Initial program 93.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 70.6%

      \[\leadsto x + \color{blue}{\frac{t \cdot y}{a}} \]
    4. Step-by-step derivation
      1. *-commutative70.6%

        \[\leadsto x + \frac{\color{blue}{y \cdot t}}{a} \]
      2. associate-/l*72.2%

        \[\leadsto x + \color{blue}{y \cdot \frac{t}{a}} \]
    5. Simplified72.2%

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

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

Alternative 8: 76.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+46} \lor \neg \left(z \leq 6 \cdot 10^{-43}\right):\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.20000000000000027e46 or 6.00000000000000007e-43 < z

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 80.3%

      \[\leadsto \color{blue}{x + y} \]
    4. Step-by-step derivation
      1. +-commutative80.3%

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified80.3%

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

    if -5.20000000000000027e46 < z < 6.00000000000000007e-43

    1. Initial program 93.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num93.9%

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

        \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}} \]
    4. Applied egg-rr94.9%

      \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}} \]
    5. Taylor expanded in z around 0 73.2%

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

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

Alternative 9: 76.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+46} \lor \neg \left(z \leq 1.55 \cdot 10^{-45}\right):\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.20000000000000027e46 or 1.55e-45 < z

    1. Initial program 99.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 80.3%

      \[\leadsto \color{blue}{x + y} \]
    4. Step-by-step derivation
      1. +-commutative80.3%

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified80.3%

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

    if -5.20000000000000027e46 < z < 1.55e-45

    1. Initial program 93.9%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 70.6%

      \[\leadsto \color{blue}{x + \frac{t \cdot y}{a}} \]
    4. Step-by-step derivation
      1. +-commutative70.6%

        \[\leadsto \color{blue}{\frac{t \cdot y}{a} + x} \]
      2. associate-/l*74.2%

        \[\leadsto \color{blue}{t \cdot \frac{y}{a}} + x \]
    5. Simplified74.2%

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

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

Alternative 10: 58.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.65 \cdot 10^{+76} \lor \neg \left(y \leq 5 \cdot 10^{+199}\right):\\
\;\;\;\;x + y\\

\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.65e76 or 4.9999999999999998e199 < y

    1. Initial program 96.7%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 65.8%

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

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified65.8%

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

    if 1.65e76 < y < 4.9999999999999998e199

    1. Initial program 99.8%

      \[x + y \cdot \frac{z - t}{z - a} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 54.8%

      \[\leadsto \color{blue}{x + \frac{t \cdot y}{a}} \]
    4. Step-by-step derivation
      1. +-commutative54.8%

        \[\leadsto \color{blue}{\frac{t \cdot y}{a} + x} \]
      2. associate-/l*71.1%

        \[\leadsto \color{blue}{t \cdot \frac{y}{a}} + x \]
    5. Simplified71.1%

      \[\leadsto \color{blue}{t \cdot \frac{y}{a} + x} \]
    6. Taylor expanded in y around inf 71.3%

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

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

      \[\leadsto \color{blue}{y \cdot \left(\frac{x}{y} + \frac{t}{a}\right)} \]
    9. Taylor expanded in x around 0 54.3%

      \[\leadsto y \cdot \color{blue}{\frac{t}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.5%

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

Alternative 11: 98.2% accurate, 1.0× speedup?

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

\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
Derivation
  1. Initial program 97.0%

    \[x + y \cdot \frac{z - t}{z - a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. clear-num97.0%

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

      \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}} \]
  4. Applied egg-rr97.5%

    \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}} \]
  5. Final simplification97.5%

    \[\leadsto x + \frac{y}{\frac{z - a}{z - t}} \]
  6. Add Preprocessing

Alternative 12: 60.6% accurate, 3.7× speedup?

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

\\
x + y
\end{array}
Derivation
  1. Initial program 97.0%

    \[x + y \cdot \frac{z - t}{z - a} \]
  2. Add Preprocessing
  3. Taylor expanded in z around inf 61.2%

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

      \[\leadsto \color{blue}{y + x} \]
  5. Simplified61.2%

    \[\leadsto \color{blue}{y + x} \]
  6. Final simplification61.2%

    \[\leadsto x + y \]
  7. Add Preprocessing

Alternative 13: 51.5% accurate, 11.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 97.0%

    \[x + y \cdot \frac{z - t}{z - a} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf 49.4%

    \[\leadsto \color{blue}{x} \]
  4. Final simplification49.4%

    \[\leadsto x \]
  5. Add Preprocessing

Developer target: 98.2% accurate, 1.0× speedup?

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

\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}

Reproduce

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

  :alt
  (+ x (/ y (/ (- z a) (- z t))))

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