Numeric.Histogram:binBounds from Chart-1.5.3

Percentage Accurate: 92.9% → 99.1%
Time: 8.4s
Alternatives: 13
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 92.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \frac{z \cdot \left(y - x\right)}{t}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+284}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (/ (* z (- y x)) t))))
   (if (<= t_1 (- INFINITY))
     (+ x (* z (/ (- y x) t)))
     (if (<= t_1 5e+284) t_1 (+ x (/ (- y x) (/ t z)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x + ((z * (y - x)) / t);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = x + (z * ((y - x) / t));
	} else if (t_1 <= 5e+284) {
		tmp = t_1;
	} else {
		tmp = x + ((y - x) / (t / z));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = x + ((z * (y - x)) / t);
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = x + (z * ((y - x) / t));
	} else if (t_1 <= 5e+284) {
		tmp = t_1;
	} else {
		tmp = x + ((y - x) / (t / z));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + ((z * (y - x)) / t)
	tmp = 0
	if t_1 <= -math.inf:
		tmp = x + (z * ((y - x) / t))
	elif t_1 <= 5e+284:
		tmp = t_1
	else:
		tmp = x + ((y - x) / (t / z))
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(Float64(z * Float64(y - x)) / t))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t)));
	elseif (t_1 <= 5e+284)
		tmp = t_1;
	else
		tmp = Float64(x + Float64(Float64(y - x) / Float64(t / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + ((z * (y - x)) / t);
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = x + (z * ((y - x) / t));
	elseif (t_1 <= 5e+284)
		tmp = t_1;
	else
		tmp = x + ((y - x) / (t / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+284], t$95$1, N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + \frac{z \cdot \left(y - x\right)}{t}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\

\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+284}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0

    1. Initial program 73.6%

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

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

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

    if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 4.9999999999999999e284

    1. Initial program 99.2%

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

    if 4.9999999999999999e284 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t))

    1. Initial program 89.7%

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

        \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}} \]
    3. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{z \cdot \left(y - x\right)}{t} \leq -\infty:\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{elif}\;x + \frac{z \cdot \left(y - x\right)}{t} \leq 5 \cdot 10^{+284}:\\ \;\;\;\;x + \frac{z \cdot \left(y - x\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array} \]

Alternative 2: 97.7% accurate, 0.1× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z}{t}, y - x, x\right)} \]
  4. Final simplification96.5%

    \[\leadsto \mathsf{fma}\left(\frac{z}{t}, y - x, x\right) \]

Alternative 3: 99.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \frac{z \cdot \left(y - x\right)}{t}\\ \mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 10^{+295}\right):\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (/ (* z (- y x)) t))))
   (if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+295)))
     (+ x (* z (/ (- y x) t)))
     t_1)))
double code(double x, double y, double z, double t) {
	double t_1 = x + ((z * (y - x)) / t);
	double tmp;
	if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 1e+295)) {
		tmp = x + (z * ((y - x) / t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = x + ((z * (y - x)) / t);
	double tmp;
	if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 1e+295)) {
		tmp = x + (z * ((y - x) / t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + ((z * (y - x)) / t)
	tmp = 0
	if (t_1 <= -math.inf) or not (t_1 <= 1e+295):
		tmp = x + (z * ((y - x) / t))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(Float64(z * Float64(y - x)) / t))
	tmp = 0.0
	if ((t_1 <= Float64(-Inf)) || !(t_1 <= 1e+295))
		tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + ((z * (y - x)) / t);
	tmp = 0.0;
	if ((t_1 <= -Inf) || ~((t_1 <= 1e+295)))
		tmp = x + (z * ((y - x) / t));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+295]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + \frac{z \cdot \left(y - x\right)}{t}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 10^{+295}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0 or 9.9999999999999998e294 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t))

    1. Initial program 81.0%

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

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

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

    if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 9.9999999999999998e294

    1. Initial program 99.2%

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

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

Alternative 4: 47.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -126000000000:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-217}:\\ \;\;\;\;\frac{x}{t} \cdot \left(-z\right)\\ \mathbf{elif}\;y \leq 2.16 \cdot 10^{-100}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{+95}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;y \leq 1.26 \cdot 10^{+162}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{t} \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -126000000000.0)
   (/ (* z y) t)
   (if (<= y 1.8e-217)
     (* (/ x t) (- z))
     (if (<= y 2.16e-100)
       x
       (if (<= y 2.6e+95)
         (* z (/ y t))
         (if (<= y 1.26e+162) x (* (/ z t) y)))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -126000000000.0) {
		tmp = (z * y) / t;
	} else if (y <= 1.8e-217) {
		tmp = (x / t) * -z;
	} else if (y <= 2.16e-100) {
		tmp = x;
	} else if (y <= 2.6e+95) {
		tmp = z * (y / t);
	} else if (y <= 1.26e+162) {
		tmp = x;
	} else {
		tmp = (z / t) * y;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= (-126000000000.0d0)) then
        tmp = (z * y) / t
    else if (y <= 1.8d-217) then
        tmp = (x / t) * -z
    else if (y <= 2.16d-100) then
        tmp = x
    else if (y <= 2.6d+95) then
        tmp = z * (y / t)
    else if (y <= 1.26d+162) then
        tmp = x
    else
        tmp = (z / t) * y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -126000000000.0) {
		tmp = (z * y) / t;
	} else if (y <= 1.8e-217) {
		tmp = (x / t) * -z;
	} else if (y <= 2.16e-100) {
		tmp = x;
	} else if (y <= 2.6e+95) {
		tmp = z * (y / t);
	} else if (y <= 1.26e+162) {
		tmp = x;
	} else {
		tmp = (z / t) * y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -126000000000.0:
		tmp = (z * y) / t
	elif y <= 1.8e-217:
		tmp = (x / t) * -z
	elif y <= 2.16e-100:
		tmp = x
	elif y <= 2.6e+95:
		tmp = z * (y / t)
	elif y <= 1.26e+162:
		tmp = x
	else:
		tmp = (z / t) * y
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -126000000000.0)
		tmp = Float64(Float64(z * y) / t);
	elseif (y <= 1.8e-217)
		tmp = Float64(Float64(x / t) * Float64(-z));
	elseif (y <= 2.16e-100)
		tmp = x;
	elseif (y <= 2.6e+95)
		tmp = Float64(z * Float64(y / t));
	elseif (y <= 1.26e+162)
		tmp = x;
	else
		tmp = Float64(Float64(z / t) * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -126000000000.0)
		tmp = (z * y) / t;
	elseif (y <= 1.8e-217)
		tmp = (x / t) * -z;
	elseif (y <= 2.16e-100)
		tmp = x;
	elseif (y <= 2.6e+95)
		tmp = z * (y / t);
	elseif (y <= 1.26e+162)
		tmp = x;
	else
		tmp = (z / t) * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -126000000000.0], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[y, 1.8e-217], N[(N[(x / t), $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[y, 2.16e-100], x, If[LessEqual[y, 2.6e+95], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.26e+162], x, N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -126000000000:\\
\;\;\;\;\frac{z \cdot y}{t}\\

\mathbf{elif}\;y \leq 1.8 \cdot 10^{-217}:\\
\;\;\;\;\frac{x}{t} \cdot \left(-z\right)\\

\mathbf{elif}\;y \leq 2.16 \cdot 10^{-100}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 2.6 \cdot 10^{+95}:\\
\;\;\;\;z \cdot \frac{y}{t}\\

\mathbf{elif}\;y \leq 1.26 \cdot 10^{+162}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -1.26e11

    1. Initial program 93.1%

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

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

      \[\leadsto \frac{\color{blue}{y \cdot z}}{t} \]
    4. Step-by-step derivation
      1. *-commutative66.9%

        \[\leadsto \frac{\color{blue}{z \cdot y}}{t} \]
    5. Simplified66.9%

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

    if -1.26e11 < y < 1.79999999999999991e-217

    1. Initial program 91.9%

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

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

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(z \cdot x\right)}}{t} \]
    4. Step-by-step derivation
      1. mul-1-neg57.2%

        \[\leadsto \frac{\color{blue}{-z \cdot x}}{t} \]
      2. distribute-rgt-neg-out57.2%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{z \cdot x}{t}} \]
    7. Step-by-step derivation
      1. mul-1-neg57.2%

        \[\leadsto \color{blue}{-\frac{z \cdot x}{t}} \]
      2. associate-*r/61.2%

        \[\leadsto -\color{blue}{z \cdot \frac{x}{t}} \]
      3. distribute-rgt-neg-in61.2%

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

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

    if 1.79999999999999991e-217 < y < 2.1600000000000001e-100 or 2.5999999999999999e95 < y < 1.26e162

    1. Initial program 97.0%

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

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

    if 2.1600000000000001e-100 < y < 2.5999999999999999e95

    1. Initial program 99.8%

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

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

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

        \[\leadsto \color{blue}{\frac{y}{t} \cdot z} \]
      2. *-commutative49.9%

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
    5. Simplified49.9%

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

    if 1.26e162 < y

    1. Initial program 86.9%

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

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

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

        \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    5. Simplified70.4%

      \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification62.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -126000000000:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-217}:\\ \;\;\;\;\frac{x}{t} \cdot \left(-z\right)\\ \mathbf{elif}\;y \leq 2.16 \cdot 10^{-100}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{+95}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;y \leq 1.26 \cdot 10^{+162}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{t} \cdot y\\ \end{array} \]

Alternative 5: 71.4% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{-79} \lor \neg \left(z \leq 2.2 \cdot 10^{-174}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.11999999999999996e-79 or 2.20000000000000022e-174 < z

    1. Initial program 91.3%

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

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

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

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

    if -1.11999999999999996e-79 < z < 2.20000000000000022e-174

    1. Initial program 98.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.12 \cdot 10^{-79} \lor \neg \left(z \leq 2.2 \cdot 10^{-174}\right):\\ \;\;\;\;z \cdot \frac{y - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 6: 83.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4100000000000 \lor \neg \left(z \leq 13\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.1e12 or 13 < z

    1. Initial program 87.8%

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

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

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

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

    if -4.1e12 < z < 13

    1. Initial program 98.4%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    3. Step-by-step derivation
      1. associate-*r/34.0%

        \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    4. Simplified83.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4100000000000 \lor \neg \left(z \leq 13\right):\\ \;\;\;\;z \cdot \frac{y - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z}{t} \cdot y\\ \end{array} \]

Alternative 7: 93.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.2 \cdot 10^{+189}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 2.20000000000000005e189

    1. Initial program 93.2%

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

        \[\leadsto x + \color{blue}{\frac{y - x}{t} \cdot z} \]
    3. Applied egg-rr92.9%

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

    if 2.20000000000000005e189 < x

    1. Initial program 96.4%

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

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

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

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

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

        \[\leadsto x + \color{blue}{\left(-\frac{z}{t}\right)} \cdot x \]
      5. cancel-sign-sub-inv99.9%

        \[\leadsto \color{blue}{x - \frac{z}{t} \cdot x} \]
      6. *-commutative99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.2 \cdot 10^{+189}:\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{z}{t} \cdot x\\ \end{array} \]

Alternative 8: 53.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{-78} \lor \neg \left(z \leq 3.6 \cdot 10^{-174}\right):\\
\;\;\;\;\frac{z}{t} \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.80000000000000023e-78 or 3.59999999999999999e-174 < z

    1. Initial program 91.3%

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

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

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

        \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    5. Simplified49.0%

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

    if -6.80000000000000023e-78 < z < 3.59999999999999999e-174

    1. Initial program 98.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.8 \cdot 10^{-78} \lor \neg \left(z \leq 3.6 \cdot 10^{-174}\right):\\ \;\;\;\;\frac{z}{t} \cdot y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 9: 52.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-80}:\\
\;\;\;\;z \cdot \frac{y}{t}\\

\mathbf{elif}\;z \leq 5.2 \cdot 10^{-174}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.20000000000000003e-80

    1. Initial program 92.4%

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

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

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

        \[\leadsto \color{blue}{\frac{y}{t} \cdot z} \]
      2. *-commutative42.4%

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
    5. Simplified42.4%

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

    if -4.20000000000000003e-80 < z < 5.2000000000000004e-174

    1. Initial program 98.6%

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

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

    if 5.2000000000000004e-174 < z

    1. Initial program 90.5%

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

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

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

        \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    5. Simplified54.2%

      \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification55.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.2 \cdot 10^{-80}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-174}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{t} \cdot y\\ \end{array} \]

Alternative 10: 52.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-80}:\\
\;\;\;\;z \cdot \frac{y}{t}\\

\mathbf{elif}\;z \leq 3.6 \cdot 10^{-174}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.3e-80

    1. Initial program 92.4%

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

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

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

        \[\leadsto \color{blue}{\frac{y}{t} \cdot z} \]
      2. *-commutative42.4%

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
    5. Simplified42.4%

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

    if -1.3e-80 < z < 3.59999999999999999e-174

    1. Initial program 98.6%

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

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

    if 3.59999999999999999e-174 < z

    1. Initial program 90.5%

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

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

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

        \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    5. Simplified54.2%

      \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    6. Step-by-step derivation
      1. clear-num54.2%

        \[\leadsto y \cdot \color{blue}{\frac{1}{\frac{t}{z}}} \]
      2. un-div-inv54.3%

        \[\leadsto \color{blue}{\frac{y}{\frac{t}{z}}} \]
    7. Applied egg-rr54.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{-80}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-174}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{t}{z}}\\ \end{array} \]

Alternative 11: 51.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.08 \cdot 10^{-82}:\\
\;\;\;\;z \cdot \frac{y}{t}\\

\mathbf{elif}\;z \leq 5.9 \cdot 10^{-174}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.07999999999999996e-82

    1. Initial program 92.4%

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

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

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

        \[\leadsto \color{blue}{\frac{y}{t} \cdot z} \]
      2. *-commutative42.4%

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
    5. Simplified42.4%

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

    if -1.07999999999999996e-82 < z < 5.9000000000000003e-174

    1. Initial program 98.6%

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

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

    if 5.9000000000000003e-174 < z

    1. Initial program 90.5%

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

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

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

        \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    5. Simplified54.2%

      \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    6. Step-by-step derivation
      1. *-commutative54.2%

        \[\leadsto \color{blue}{\frac{z}{t} \cdot y} \]
      2. associate-*l/51.0%

        \[\leadsto \color{blue}{\frac{z \cdot y}{t}} \]
      3. associate-/l*54.5%

        \[\leadsto \color{blue}{\frac{z}{\frac{t}{y}}} \]
    7. Applied egg-rr54.5%

      \[\leadsto \color{blue}{\frac{z}{\frac{t}{y}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification55.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.08 \cdot 10^{-82}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;z \leq 5.9 \cdot 10^{-174}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \end{array} \]

Alternative 12: 50.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-83}:\\
\;\;\;\;\frac{z \cdot y}{t}\\

\mathbf{elif}\;z \leq 5.9 \cdot 10^{-174}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.79999999999999977e-83

    1. Initial program 92.4%

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

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

      \[\leadsto \frac{\color{blue}{y \cdot z}}{t} \]
    4. Step-by-step derivation
      1. *-commutative43.6%

        \[\leadsto \frac{\color{blue}{z \cdot y}}{t} \]
    5. Simplified43.6%

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

    if -3.79999999999999977e-83 < z < 5.9000000000000003e-174

    1. Initial program 98.6%

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

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

    if 5.9000000000000003e-174 < z

    1. Initial program 90.5%

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

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

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

        \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    5. Simplified54.2%

      \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    6. Step-by-step derivation
      1. *-commutative54.2%

        \[\leadsto \color{blue}{\frac{z}{t} \cdot y} \]
      2. associate-*l/51.0%

        \[\leadsto \color{blue}{\frac{z \cdot y}{t}} \]
      3. associate-/l*54.5%

        \[\leadsto \color{blue}{\frac{z}{\frac{t}{y}}} \]
    7. Applied egg-rr54.5%

      \[\leadsto \color{blue}{\frac{z}{\frac{t}{y}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification55.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{-83}:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{elif}\;z \leq 5.9 \cdot 10^{-174}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \end{array} \]

Alternative 13: 38.5% accurate, 9.0× speedup?

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

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

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

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

    \[\leadsto x \]

Developer target: 97.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (< x -9.025511195533005e-135)
   (- x (* (/ z t) (- x y)))
   (if (< x 4.275032163700715e-250)
     (+ x (* (/ (- y x) t) z))
     (+ x (/ (- y x) (/ t z))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x < -9.025511195533005e-135) {
		tmp = x - ((z / t) * (x - y));
	} else if (x < 4.275032163700715e-250) {
		tmp = x + (((y - x) / t) * z);
	} else {
		tmp = x + ((y - x) / (t / z));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x < (-9.025511195533005d-135)) then
        tmp = x - ((z / t) * (x - y))
    else if (x < 4.275032163700715d-250) then
        tmp = x + (((y - x) / t) * z)
    else
        tmp = x + ((y - x) / (t / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x < -9.025511195533005e-135) {
		tmp = x - ((z / t) * (x - y));
	} else if (x < 4.275032163700715e-250) {
		tmp = x + (((y - x) / t) * z);
	} else {
		tmp = x + ((y - x) / (t / z));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x < -9.025511195533005e-135:
		tmp = x - ((z / t) * (x - y))
	elif x < 4.275032163700715e-250:
		tmp = x + (((y - x) / t) * z)
	else:
		tmp = x + ((y - x) / (t / z))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x < -9.025511195533005e-135)
		tmp = Float64(x - Float64(Float64(z / t) * Float64(x - y)));
	elseif (x < 4.275032163700715e-250)
		tmp = Float64(x + Float64(Float64(Float64(y - x) / t) * z));
	else
		tmp = Float64(x + Float64(Float64(y - x) / Float64(t / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x < -9.025511195533005e-135)
		tmp = x - ((z / t) * (x - y));
	elseif (x < 4.275032163700715e-250)
		tmp = x + (((y - x) / t) * z);
	else
		tmp = x + ((y - x) / (t / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Less[x, -9.025511195533005e-135], N[(x - N[(N[(z / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[x, 4.275032163700715e-250], N[(x + N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\
\;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\

\mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023224 
(FPCore (x y z t)
  :name "Numeric.Histogram:binBounds from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))

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