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

Percentage Accurate: 96.8% → 99.6%
Time: 12.2s
Alternatives: 10
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 10 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: 96.8% 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.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\frac{y - z}{-1 + \left(z - t\right)}, a, x\right) \end{array} \]
(FPCore (x y z t a) :precision binary64 (fma (/ (- y z) (+ -1.0 (- z t))) a x))
double code(double x, double y, double z, double t, double a) {
	return fma(((y - z) / (-1.0 + (z - t))), a, x);
}
function code(x, y, z, t, a)
	return fma(Float64(Float64(y - z) / Float64(-1.0 + Float64(z - t))), a, x)
end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\frac{y - z}{-1 + \left(z - t\right)}, a, x\right)
\end{array}
Derivation
  1. Initial program 96.5%

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y - z}{-\left(\left(t - z\right) + 1\right)}}, a, x\right) \]
    7. distribute-neg-in99.6%

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{\left(-\left(t - z\right)\right) + \left(-1\right)}}, a, x\right) \]
    8. sub-neg99.6%

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\left(-\color{blue}{\left(t + \left(-z\right)\right)}\right) + \left(-1\right)}, a, x\right) \]
    9. distribute-neg-in99.6%

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{\left(\left(-t\right) + \left(-\left(-z\right)\right)\right)} + \left(-1\right)}, a, x\right) \]
    10. remove-double-neg99.6%

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\left(\left(-t\right) + \color{blue}{z}\right) + \left(-1\right)}, a, x\right) \]
    11. +-commutative99.6%

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{\left(z + \left(-t\right)\right)} + \left(-1\right)}, a, x\right) \]
    12. sub-neg99.6%

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - z}{\left(z - t\right) + -1}, a, x\right)} \]
  4. Add Preprocessing
  5. Final simplification99.6%

    \[\leadsto \mathsf{fma}\left(\frac{y - z}{-1 + \left(z - t\right)}, a, x\right) \]
  6. Add Preprocessing

Alternative 2: 91.5% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -5.5000000000000001e114 or 2.8999999999999998e69 < t

    1. Initial program 97.5%

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

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

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

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

    if -5.5000000000000001e114 < t < 2.8999999999999998e69

    1. Initial program 96.0%

      \[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. Add Preprocessing
    5. Taylor expanded in t around 0 95.6%

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

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

Alternative 3: 85.3% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;z \leq 1.7 \cdot 10^{+81}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\

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


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

    1. Initial program 92.1%

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

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

        \[\leadsto x - \frac{y - z}{\color{blue}{\frac{-1 \cdot z}{a}}} \]
      2. neg-mul-183.3%

        \[\leadsto x - \frac{y - z}{\frac{\color{blue}{-z}}{a}} \]
    5. Simplified83.3%

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

    if -2.1e21 < z < 1.70000000000000001e81

    1. Initial program 99.8%

      \[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. Add Preprocessing
    5. Taylor expanded in z around 0 93.0%

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

    if 1.70000000000000001e81 < z

    1. Initial program 90.8%

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

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

        \[\leadsto x - \frac{y - z}{\color{blue}{\frac{-1 \cdot z}{a}}} \]
      2. neg-mul-188.1%

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

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

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

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

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

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

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

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

Alternative 4: 87.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+21} \lor \neg \left(z \leq 3.6 \cdot 10^{+15}\right):\\
\;\;\;\;x + \frac{y - z}{\frac{z}{a}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.6e21 or 3.6e15 < z

    1. Initial program 92.4%

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

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

        \[\leadsto x - \frac{y - z}{\color{blue}{\frac{-1 \cdot z}{a}}} \]
      2. neg-mul-183.8%

        \[\leadsto x - \frac{y - z}{\frac{\color{blue}{-z}}{a}} \]
    5. Simplified83.8%

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

    if -1.6e21 < z < 3.6e15

    1. Initial program 99.8%

      \[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. Add Preprocessing
    5. Taylor expanded in z around 0 95.1%

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

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

Alternative 5: 84.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+80} \lor \neg \left(z \leq 1.7 \cdot 10^{+81}\right):\\
\;\;\;\;x - a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.499999999999999e80 or 1.70000000000000001e81 < z

    1. Initial program 90.9%

      \[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. Add Preprocessing
    5. Taylor expanded in z around inf 80.7%

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

    if -9.499999999999999e80 < z < 1.70000000000000001e81

    1. Initial program 99.8%

      \[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. Add Preprocessing
    5. Taylor expanded in z around 0 92.2%

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

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

Alternative 6: 70.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+21} \lor \neg \left(z \leq 1.66 \cdot 10^{+109}\right):\\
\;\;\;\;x - a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.02e21 or 1.6599999999999999e109 < z

    1. Initial program 90.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. Add Preprocessing
    5. Taylor expanded in z around inf 83.8%

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

    if -1.02e21 < z < 1.6599999999999999e109

    1. Initial program 99.8%

      \[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. Add Preprocessing
    5. Taylor expanded in t around inf 68.5%

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

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

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

Alternative 7: 66.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+21} \lor \neg \left(z \leq 3400000000000\right):\\
\;\;\;\;x - a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9e21 or 3.4e12 < z

    1. Initial program 92.4%

      \[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. Add Preprocessing
    5. Taylor expanded in z around inf 77.3%

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

    if -9e21 < z < 3.4e12

    1. Initial program 99.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-\frac{y - z}{\left(t - z\right) + 1}, a, x\right)} \]
      6. distribute-neg-frac299.3%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y - z}{-\left(\left(t - z\right) + 1\right)}}, a, x\right) \]
      7. distribute-neg-in99.3%

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

        \[\leadsto \mathsf{fma}\left(\frac{y - z}{\left(-\color{blue}{\left(t + \left(-z\right)\right)}\right) + \left(-1\right)}, a, x\right) \]
      9. distribute-neg-in99.3%

        \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{\left(\left(-t\right) + \left(-\left(-z\right)\right)\right)} + \left(-1\right)}, a, x\right) \]
      10. remove-double-neg99.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9 \cdot 10^{+21} \lor \neg \left(z \leq 3400000000000\right):\\ \;\;\;\;x - a\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 99.6% accurate, 1.0× speedup?

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

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

    \[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. Add Preprocessing
  5. Final simplification99.6%

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

Alternative 9: 54.7% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{+202} \lor \neg \left(a \leq 1.28 \cdot 10^{+129}\right):\\
\;\;\;\;-a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.09999999999999991e202 or 1.27999999999999994e129 < a

    1. Initial program 99.7%

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

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

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

      \[\leadsto x - \color{blue}{a} \]
    6. Taylor expanded in x around 0 33.6%

      \[\leadsto \color{blue}{-1 \cdot a} \]
    7. Step-by-step derivation
      1. neg-mul-133.6%

        \[\leadsto \color{blue}{-a} \]
    8. Simplified33.6%

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

    if -3.09999999999999991e202 < a < 1.27999999999999994e129

    1. Initial program 95.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-\frac{y - z}{\left(t - z\right) + 1}, a, x\right)} \]
      6. distribute-neg-frac299.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y - z}{-\left(\left(t - z\right) + 1\right)}}, a, x\right) \]
      7. distribute-neg-in99.9%

        \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{\left(-\left(t - z\right)\right) + \left(-1\right)}}, a, x\right) \]
      8. sub-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{\left(\left(-t\right) + \left(-\left(-z\right)\right)\right)} + \left(-1\right)}, a, x\right) \]
      10. remove-double-neg99.9%

        \[\leadsto \mathsf{fma}\left(\frac{y - z}{\left(\left(-t\right) + \color{blue}{z}\right) + \left(-1\right)}, a, x\right) \]
      11. +-commutative99.9%

        \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{\left(z + \left(-t\right)\right)} + \left(-1\right)}, a, x\right) \]
      12. sub-neg99.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -3.1 \cdot 10^{+202} \lor \neg \left(a \leq 1.28 \cdot 10^{+129}\right):\\ \;\;\;\;-a\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 53.4% 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.5%

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y - z}{-\left(\left(t - z\right) + 1\right)}}, a, x\right) \]
    7. distribute-neg-in99.6%

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{\left(-\left(t - z\right)\right) + \left(-1\right)}}, a, x\right) \]
    8. sub-neg99.6%

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\left(-\color{blue}{\left(t + \left(-z\right)\right)}\right) + \left(-1\right)}, a, x\right) \]
    9. distribute-neg-in99.6%

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{\left(\left(-t\right) + \left(-\left(-z\right)\right)\right)} + \left(-1\right)}, a, x\right) \]
    10. remove-double-neg99.6%

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\left(\left(-t\right) + \color{blue}{z}\right) + \left(-1\right)}, a, x\right) \]
    11. +-commutative99.6%

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{\left(z + \left(-t\right)\right)} + \left(-1\right)}, a, x\right) \]
    12. sub-neg99.6%

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

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

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

    \[\leadsto \color{blue}{x} \]
  6. Add Preprocessing

Developer Target 1: 99.6% 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 2024146 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
  :precision binary64

  :alt
  (! :herbie-platform default (- x (* (/ (- y z) (+ (- t z) 1)) a)))

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