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

Percentage Accurate: 85.1% → 98.1%
Time: 8.4s
Alternatives: 8
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x + \frac{y \cdot \left(z - t\right)}{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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

\[\begin{array}{l} \\ x + \frac{y \cdot \left(z - t\right)}{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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 98.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

Alternative 2: 81.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{-103} \lor \neg \left(z \leq 3.4 \cdot 10^{-94}\right):\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.40000000000000003e-103 or 3.3999999999999998e-94 < z

    1. Initial program 78.4%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{z - a}} \]
    4. Step-by-step derivation
      1. associate-/l*81.2%

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

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

    if -3.40000000000000003e-103 < z < 3.3999999999999998e-94

    1. Initial program 94.6%

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

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

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

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

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

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

Alternative 3: 87.1% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.02e34 or 1.65e-10 < t

    1. Initial program 82.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.02e34 < t < 1.65e-10

    1. Initial program 83.8%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{z - a}} \]
    4. Step-by-step derivation
      1. associate-/l*92.6%

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

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

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

Alternative 4: 62.9% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;z \leq 4.1 \cdot 10^{-265}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\

\mathbf{elif}\;z \leq 2.35 \cdot 10^{-38}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.4999999999999998e-232 or 2.34999999999999999e-38 < z

    1. Initial program 77.9%

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

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

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified68.7%

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

    if -3.4999999999999998e-232 < z < 4.1e-265

    1. Initial program 95.2%

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

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

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{y}{a}\right)} \cdot \left(z - t\right) \]
    7. Step-by-step derivation
      1. associate-*r/66.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot y}{a}} \cdot \left(z - t\right) \]
      2. neg-mul-166.9%

        \[\leadsto \frac{\color{blue}{-y}}{a} \cdot \left(z - t\right) \]
    8. Simplified66.9%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot \left(z - t\right)}{a}} \]
    10. Step-by-step derivation
      1. associate-*r/66.4%

        \[\leadsto -1 \cdot \color{blue}{\left(y \cdot \frac{z - t}{a}\right)} \]
      2. *-rgt-identity66.4%

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

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

        \[\leadsto -1 \cdot \left(y \cdot \color{blue}{\left(\frac{z}{a} - \frac{t}{a}\right)}\right) \]
      5. sub-neg66.4%

        \[\leadsto -1 \cdot \left(y \cdot \color{blue}{\left(\frac{z}{a} + \left(-\frac{t}{a}\right)\right)}\right) \]
      6. neg-mul-166.4%

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

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

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

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

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

        \[\leadsto -1 \cdot \left(\frac{y \cdot z}{a} + \left(-\color{blue}{\frac{y \cdot t}{a}}\right)\right) \]
      12. *-commutative67.1%

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

        \[\leadsto -1 \cdot \left(\frac{y \cdot z}{a} + \left(-\color{blue}{t \cdot \frac{y}{a}}\right)\right) \]
      14. unsub-neg66.9%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot z}{a} - -1 \cdot \left(t \cdot \frac{y}{a}\right)} \]
      16. neg-mul-166.9%

        \[\leadsto -1 \cdot \frac{y \cdot z}{a} - \color{blue}{\left(-t \cdot \frac{y}{a}\right)} \]
      17. distribute-lft-neg-in66.9%

        \[\leadsto -1 \cdot \frac{y \cdot z}{a} - \color{blue}{\left(-t\right) \cdot \frac{y}{a}} \]
      18. cancel-sign-sub66.9%

        \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot z}{a} + t \cdot \frac{y}{a}} \]
      19. +-commutative66.9%

        \[\leadsto \color{blue}{t \cdot \frac{y}{a} + -1 \cdot \frac{y \cdot z}{a}} \]
    11. Simplified66.9%

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

    if 4.1e-265 < z < 2.34999999999999999e-38

    1. Initial program 97.9%

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

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

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

Alternative 5: 76.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+65} \lor \neg \left(z \leq 1.65 \cdot 10^{+44}\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 -1.15e+65) (not (<= z 1.65e+44))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z <= -1.15e+65) || !(z <= 1.65e+44)) {
		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 <= (-1.15d+65)) .or. (.not. (z <= 1.65d+44))) 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 <= -1.15e+65) || !(z <= 1.65e+44)) {
		tmp = x + y;
	} else {
		tmp = x + (y * (t / a));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (z <= -1.15e+65) or not (z <= 1.65e+44):
		tmp = x + y
	else:
		tmp = x + (y * (t / a))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((z <= -1.15e+65) || !(z <= 1.65e+44))
		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 <= -1.15e+65) || ~((z <= 1.65e+44)))
		tmp = x + y;
	else
		tmp = x + (y * (t / a));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.15e+65], N[Not[LessEqual[z, 1.65e+44]], $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 -1.15 \cdot 10^{+65} \lor \neg \left(z \leq 1.65 \cdot 10^{+44}\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 < -1.15e65 or 1.65000000000000007e44 < z

    1. Initial program 68.0%

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

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

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

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

    if -1.15e65 < z < 1.65000000000000007e44

    1. Initial program 95.2%

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

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

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

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

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

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

Alternative 6: 64.0% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+20} \lor \neg \left(z \leq 2.5 \cdot 10^{-38}\right):\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.85e20 or 2.50000000000000017e-38 < z

    1. Initial program 73.1%

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

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

        \[\leadsto \color{blue}{y + x} \]
    5. Simplified72.9%

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

    if -1.85e20 < z < 2.50000000000000017e-38

    1. Initial program 95.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.85 \cdot 10^{+20} \lor \neg \left(z \leq 2.5 \cdot 10^{-38}\right):\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 53.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.7 \cdot 10^{-208}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-139}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= x -5.7e-208) x (if (<= x 1.05e-139) y x)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -5.7e-208) {
		tmp = x;
	} else if (x <= 1.05e-139) {
		tmp = 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 (x <= (-5.7d-208)) then
        tmp = x
    else if (x <= 1.05d-139) then
        tmp = 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 (x <= -5.7e-208) {
		tmp = x;
	} else if (x <= 1.05e-139) {
		tmp = y;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if x <= -5.7e-208:
		tmp = x
	elif x <= 1.05e-139:
		tmp = y
	else:
		tmp = x
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (x <= -5.7e-208)
		tmp = x;
	elseif (x <= 1.05e-139)
		tmp = y;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (x <= -5.7e-208)
		tmp = x;
	elseif (x <= 1.05e-139)
		tmp = y;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -5.7e-208], x, If[LessEqual[x, 1.05e-139], y, x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.7 \cdot 10^{-208}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 1.05 \cdot 10^{-139}:\\
\;\;\;\;y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.7000000000000004e-208 or 1.05000000000000004e-139 < x

    1. Initial program 84.5%

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

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

    if -5.7000000000000004e-208 < x < 1.05000000000000004e-139

    1. Initial program 77.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.7 \cdot 10^{-208}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-139}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 50.2% 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 83.0%

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

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

    \[\leadsto x \]
  5. Add Preprocessing

Developer target: 98.3% 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 2024078 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
  :precision binary64

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

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