Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3

Percentage Accurate: 97.2% → 99.7%
Time: 8.0s
Alternatives: 8
Speedup: 1.0×

Specification

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

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

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

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

Alternative 1: 99.7% accurate, 1.0× speedup?

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

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

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

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

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

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

Alternative 2: 87.6% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.5999999999999997e41 or 9.2e7 < z

    1. Initial program 95.1%

      \[x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}} \]
    2. Taylor expanded in z around inf 88.0%

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

        \[\leadsto x - \frac{y - z}{\color{blue}{-\frac{z}{a}}} \]
      2. distribute-neg-frac88.0%

        \[\leadsto x - \frac{y - z}{\color{blue}{\frac{-z}{a}}} \]
    4. Simplified88.0%

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

    if -4.5999999999999997e41 < z < 9.2e7

    1. Initial program 98.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.6 \cdot 10^{+41} \lor \neg \left(z \leq 92000000\right):\\ \;\;\;\;x + \frac{z - y}{\frac{-z}{a}}\\ \mathbf{else}:\\ \;\;\;\;x - a \cdot \frac{y}{t + 1}\\ \end{array} \]

Alternative 3: 70.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+67}:\\
\;\;\;\;x - a\\

\mathbf{elif}\;z \leq -1.45 \cdot 10^{-212}:\\
\;\;\;\;x - y \cdot a\\

\mathbf{elif}\;z \leq 7000000000:\\
\;\;\;\;x - \frac{y \cdot a}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.5000000000000002e67 or 7e9 < z

    1. Initial program 94.8%

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

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

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

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

    if -9.5000000000000002e67 < z < -1.45e-212

    1. Initial program 99.9%

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

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

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

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

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

    if -1.45e-212 < z < 7e9

    1. Initial program 97.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{+67}:\\ \;\;\;\;x - a\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-212}:\\ \;\;\;\;x - y \cdot a\\ \mathbf{elif}\;z \leq 7000000000:\\ \;\;\;\;x - \frac{y \cdot a}{t}\\ \mathbf{else}:\\ \;\;\;\;x - a\\ \end{array} \]

Alternative 4: 85.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+87}:\\
\;\;\;\;x - a\\

\mathbf{elif}\;z \leq 5100000000000:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.59999999999999998e87 or 5.1e12 < z

    1. Initial program 94.7%

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

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

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

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

    if -2.59999999999999998e87 < z < 5.1e12

    1. Initial program 98.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{+87}:\\ \;\;\;\;x - a\\ \mathbf{elif}\;z \leq 5100000000000:\\ \;\;\;\;x - a \cdot \frac{y}{t + 1}\\ \mathbf{else}:\\ \;\;\;\;x - a\\ \end{array} \]

Alternative 5: 65.4% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+67}:\\
\;\;\;\;x - a\\

\mathbf{elif}\;z \leq 10^{+69}:\\
\;\;\;\;x + z \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.8000000000000002e67 or 1.0000000000000001e69 < z

    1. Initial program 94.2%

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

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

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

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

    if -3.8000000000000002e67 < z < 1.0000000000000001e69

    1. Initial program 98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \frac{a}{\frac{\color{blue}{\left(-1\right) + \left(-\left(t - z\right)\right)}}{z}} \]
      5. metadata-eval61.7%

        \[\leadsto x - \frac{a}{\frac{\color{blue}{-1} + \left(-\left(t - z\right)\right)}{z}} \]
      6. unsub-neg61.7%

        \[\leadsto x - \frac{a}{\frac{\color{blue}{-1 - \left(t - z\right)}}{z}} \]
    8. Simplified61.7%

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

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

        \[\leadsto x - \frac{a}{\color{blue}{-\frac{1 + t}{z}}} \]
      2. distribute-frac-neg62.4%

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

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

        \[\leadsto x - \frac{a}{\frac{\color{blue}{-1} + \left(-t\right)}{z}} \]
      5. sub-neg62.4%

        \[\leadsto x - \frac{a}{\frac{\color{blue}{-1 - t}}{z}} \]
    11. Simplified62.4%

      \[\leadsto x - \frac{a}{\color{blue}{\frac{-1 - t}{z}}} \]
    12. Taylor expanded in t around 0 58.0%

      \[\leadsto \color{blue}{x - -1 \cdot \left(a \cdot z\right)} \]
    13. Step-by-step derivation
      1. cancel-sign-sub-inv58.0%

        \[\leadsto \color{blue}{x + \left(--1\right) \cdot \left(a \cdot z\right)} \]
      2. metadata-eval58.0%

        \[\leadsto x + \color{blue}{1} \cdot \left(a \cdot z\right) \]
      3. *-lft-identity58.0%

        \[\leadsto x + \color{blue}{a \cdot z} \]
    14. Simplified58.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+67}:\\ \;\;\;\;x - a\\ \mathbf{elif}\;z \leq 10^{+69}:\\ \;\;\;\;x + z \cdot a\\ \mathbf{else}:\\ \;\;\;\;x - a\\ \end{array} \]

Alternative 6: 73.3% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+67}:\\
\;\;\;\;x - a\\

\mathbf{elif}\;z \leq 59000:\\
\;\;\;\;x - y \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.8000000000000002e67 or 59000 < z

    1. Initial program 94.8%

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

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

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

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

    if -3.8000000000000002e67 < z < 59000

    1. Initial program 98.5%

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

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

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

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

      \[\leadsto x - \color{blue}{a \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification73.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+67}:\\ \;\;\;\;x - a\\ \mathbf{elif}\;z \leq 59000:\\ \;\;\;\;x - y \cdot a\\ \mathbf{else}:\\ \;\;\;\;x - a\\ \end{array} \]

Alternative 7: 65.7% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2300000000:\\
\;\;\;\;x - a\\

\mathbf{elif}\;z \leq 2.05 \cdot 10^{-131}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.3e9 or 2.0500000000000001e-131 < z

    1. Initial program 95.6%

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

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

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

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

    if -2.3e9 < z < 2.0500000000000001e-131

    1. Initial program 98.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2300000000:\\ \;\;\;\;x - a\\ \mathbf{elif}\;z \leq 2.05 \cdot 10^{-131}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - a\\ \end{array} \]

Alternative 8: 54.1% 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 96.9%

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

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

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification52.2%

    \[\leadsto x \]

Developer target: 99.7% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2023230 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (- x (* (/ (- y z) (+ (- t z) 1.0)) a))

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