Numeric.Histogram:binBounds from Chart-1.5.3

Percentage Accurate: 92.0% → 97.4%
Time: 10.2s
Alternatives: 12
Speedup: 1.0×

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 12 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.0% 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: 97.4% 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 94.0%

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

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

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

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

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

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

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

Alternative 2: 72.3% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+154} \lor \neg \left(y \leq 3.6 \cdot 10^{-75} \lor \neg \left(y \leq 5.2 \cdot 10^{+87}\right) \land y \leq 8 \cdot 10^{+181}\right):\\
\;\;\;\;\frac{z}{t} \cdot \left(y - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.3e154 or 3.6e-75 < y < 5.19999999999999997e87 or 7.9999999999999993e181 < y

    1. Initial program 90.9%

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

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

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

        \[\leadsto \color{blue}{\frac{z}{\frac{t}{y - x}}} \]
      2. associate-/r/76.0%

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

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

    if -2.3e154 < y < 3.6e-75 or 5.19999999999999997e87 < y < 7.9999999999999993e181

    1. Initial program 95.6%

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 - \frac{z}{t}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification82.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.3 \cdot 10^{+154} \lor \neg \left(y \leq 3.6 \cdot 10^{-75} \lor \neg \left(y \leq 5.2 \cdot 10^{+87}\right) \land y \leq 8 \cdot 10^{+181}\right):\\ \;\;\;\;\frac{z}{t} \cdot \left(y - x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 94.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \frac{z \cdot \left(y - x\right)}{t}\\ \mathbf{if}\;t_1 \leq 2 \cdot 10^{+299}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\frac{t}{y - x}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (/ (* z (- y x)) t))))
   (if (<= t_1 2e+299) t_1 (/ z (/ t (- y x))))))
double code(double x, double y, double z, double t) {
	double t_1 = x + ((z * (y - x)) / t);
	double tmp;
	if (t_1 <= 2e+299) {
		tmp = t_1;
	} else {
		tmp = z / (t / (y - 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) :: t_1
    real(8) :: tmp
    t_1 = x + ((z * (y - x)) / t)
    if (t_1 <= 2d+299) then
        tmp = t_1
    else
        tmp = z / (t / (y - x))
    end if
    code = tmp
end function
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 <= 2e+299) {
		tmp = t_1;
	} else {
		tmp = z / (t / (y - x));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + ((z * (y - x)) / t)
	tmp = 0
	if t_1 <= 2e+299:
		tmp = t_1
	else:
		tmp = z / (t / (y - x))
	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 <= 2e+299)
		tmp = t_1;
	else
		tmp = Float64(z / Float64(t / Float64(y - x)));
	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 <= 2e+299)
		tmp = t_1;
	else
		tmp = z / (t / (y - x));
	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, 2e+299], t$95$1, N[(z / N[(t / N[(y - x), $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 2 \cdot 10^{+299}:\\
\;\;\;\;t_1\\

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


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

    1. Initial program 98.5%

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

    if 2.0000000000000001e299 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t))

    1. Initial program 74.9%

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

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

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

        \[\leadsto \color{blue}{\frac{z}{\frac{t}{y - x}}} \]
    6. Simplified92.0%

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

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

Alternative 4: 73.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-136} \lor \neg \left(x \leq 7.2 \cdot 10^{-201}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.6999999999999998e-136 or 7.20000000000000063e-201 < x

    1. Initial program 93.2%

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

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

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

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

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

    if -2.6999999999999998e-136 < x < 7.20000000000000063e-201

    1. Initial program 96.7%

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

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

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

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

Alternative 5: 84.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.62 \cdot 10^{+66} \lor \neg \left(x \leq 4600000000000\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.62e66 or 4.6e12 < x

    1. Initial program 90.1%

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

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

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

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

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

    if -1.62e66 < x < 4.6e12

    1. Initial program 97.2%

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

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

        \[\leadsto x + \color{blue}{\frac{y}{\frac{t}{z}}} \]
      2. associate-/r/83.8%

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

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

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

Alternative 6: 85.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{+69} \lor \neg \left(x \leq 680000000000\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.60000000000000033e69 or 6.8e11 < x

    1. Initial program 90.1%

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

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

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

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

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

    if -4.60000000000000033e69 < x < 6.8e11

    1. Initial program 97.2%

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

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

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

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

        \[\leadsto x + \color{blue}{\frac{z}{\frac{t}{y}}} \]
      2. associate-/r/85.6%

        \[\leadsto x + \color{blue}{\frac{z}{t} \cdot y} \]
    7. Applied egg-rr85.6%

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

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

Alternative 7: 53.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+60} \lor \neg \left(z \leq 2.6 \cdot 10^{+104}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.30000000000000004e60 or 2.6e104 < z

    1. Initial program 85.8%

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

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

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

    if -1.30000000000000004e60 < z < 2.6e104

    1. Initial program 98.2%

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

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

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

Alternative 8: 51.1% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;z \leq 3.8 \cdot 10^{+104}:\\
\;\;\;\;x\\

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


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

    1. Initial program 88.5%

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

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

        \[\leadsto x + \frac{\color{blue}{-x \cdot z}}{t} \]
      2. distribute-lft-neg-out56.8%

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

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

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

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

        \[\leadsto x + \color{blue}{\left(\left(-x\right) \cdot z\right)} \cdot \frac{1}{t} \]
      3. add-sqr-sqrt31.3%

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

        \[\leadsto x + \left(\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} \cdot z\right) \cdot \frac{1}{t} \]
      5. sqr-neg34.4%

        \[\leadsto x + \left(\sqrt{\color{blue}{x \cdot x}} \cdot z\right) \cdot \frac{1}{t} \]
      6. sqrt-unprod3.2%

        \[\leadsto x + \left(\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot z\right) \cdot \frac{1}{t} \]
      7. add-sqr-sqrt5.9%

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

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

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

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

        \[\leadsto \color{blue}{x - \left(z \cdot \left(-x\right)\right) \cdot \frac{1}{t}} \]
      12. *-commutative5.9%

        \[\leadsto x - \color{blue}{\left(\left(-x\right) \cdot z\right)} \cdot \frac{1}{t} \]
      13. associate-*l*10.7%

        \[\leadsto x - \color{blue}{\left(-x\right) \cdot \left(z \cdot \frac{1}{t}\right)} \]
      14. div-inv10.7%

        \[\leadsto x - \left(-x\right) \cdot \color{blue}{\frac{z}{t}} \]
      15. add-sqr-sqrt2.7%

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

        \[\leadsto x - \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} \cdot \frac{z}{t} \]
      17. sqr-neg27.8%

        \[\leadsto x - \sqrt{\color{blue}{x \cdot x}} \cdot \frac{z}{t} \]
      18. sqrt-unprod32.6%

        \[\leadsto x - \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{z}{t} \]
      19. add-sqr-sqrt68.4%

        \[\leadsto x - \color{blue}{x} \cdot \frac{z}{t} \]
    7. Applied egg-rr68.4%

      \[\leadsto \color{blue}{x - x \cdot \frac{z}{t}} \]
    8. Taylor expanded in z around inf 56.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot z}{t}} \]
    9. Step-by-step derivation
      1. mul-1-neg56.8%

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

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

        \[\leadsto \color{blue}{\frac{x}{t} \cdot \left(-z\right)} \]
    10. Simplified63.7%

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

    if -1.9000000000000001e130 < z < 3.79999999999999969e104

    1. Initial program 97.8%

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

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

    if 3.79999999999999969e104 < z

    1. Initial program 82.1%

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

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

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

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

Alternative 9: 52.1% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;z \leq 2.4 \cdot 10^{+104}:\\
\;\;\;\;x\\

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


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

    1. Initial program 87.2%

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

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

        \[\leadsto x + \frac{\color{blue}{-x \cdot z}}{t} \]
      2. distribute-lft-neg-out54.1%

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

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

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

        \[\leadsto x + \color{blue}{\left(z \cdot \left(-x\right)\right) \cdot \frac{1}{t}} \]
      2. *-commutative54.0%

        \[\leadsto x + \color{blue}{\left(\left(-x\right) \cdot z\right)} \cdot \frac{1}{t} \]
      3. add-sqr-sqrt28.5%

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

        \[\leadsto x + \left(\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} \cdot z\right) \cdot \frac{1}{t} \]
      5. sqr-neg31.4%

        \[\leadsto x + \left(\sqrt{\color{blue}{x \cdot x}} \cdot z\right) \cdot \frac{1}{t} \]
      6. sqrt-unprod5.2%

        \[\leadsto x + \left(\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot z\right) \cdot \frac{1}{t} \]
      7. add-sqr-sqrt7.8%

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

        \[\leadsto x + \color{blue}{\left(z \cdot x\right)} \cdot \frac{1}{t} \]
      9. remove-double-neg7.8%

        \[\leadsto x + \color{blue}{\left(-\left(-z \cdot x\right)\right)} \cdot \frac{1}{t} \]
      10. distribute-rgt-neg-out7.8%

        \[\leadsto x + \left(-\color{blue}{z \cdot \left(-x\right)}\right) \cdot \frac{1}{t} \]
      11. cancel-sign-sub-inv7.8%

        \[\leadsto \color{blue}{x - \left(z \cdot \left(-x\right)\right) \cdot \frac{1}{t}} \]
      12. *-commutative7.8%

        \[\leadsto x - \color{blue}{\left(\left(-x\right) \cdot z\right)} \cdot \frac{1}{t} \]
      13. associate-*l*14.3%

        \[\leadsto x - \color{blue}{\left(-x\right) \cdot \left(z \cdot \frac{1}{t}\right)} \]
      14. div-inv14.3%

        \[\leadsto x - \left(-x\right) \cdot \color{blue}{\frac{z}{t}} \]
      15. add-sqr-sqrt4.8%

        \[\leadsto x - \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)} \cdot \frac{z}{t} \]
      16. sqrt-unprod25.4%

        \[\leadsto x - \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} \cdot \frac{z}{t} \]
      17. sqr-neg25.4%

        \[\leadsto x - \sqrt{\color{blue}{x \cdot x}} \cdot \frac{z}{t} \]
      18. sqrt-unprod31.9%

        \[\leadsto x - \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{z}{t} \]
      19. add-sqr-sqrt66.7%

        \[\leadsto x - \color{blue}{x} \cdot \frac{z}{t} \]
    7. Applied egg-rr66.7%

      \[\leadsto \color{blue}{x - x \cdot \frac{z}{t}} \]
    8. Taylor expanded in z around inf 51.9%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{t} \cdot \left(-z\right)} \]
    10. Simplified58.1%

      \[\leadsto \color{blue}{\frac{x}{t} \cdot \left(-z\right)} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt58.1%

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

        \[\leadsto \frac{x}{t} \cdot \color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}} \]
      3. sqr-neg56.0%

        \[\leadsto \frac{x}{t} \cdot \sqrt{\color{blue}{z \cdot z}} \]
      4. sqrt-unprod0.0%

        \[\leadsto \frac{x}{t} \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \]
      5. add-sqr-sqrt5.6%

        \[\leadsto \frac{x}{t} \cdot \color{blue}{z} \]
      6. associate-*l/5.6%

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

        \[\leadsto \color{blue}{x \cdot \frac{z}{t}} \]
      8. frac-2neg12.1%

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

        \[\leadsto \color{blue}{\frac{x \cdot \left(-z\right)}{-t}} \]
      10. *-commutative5.6%

        \[\leadsto \frac{\color{blue}{\left(-z\right) \cdot x}}{-t} \]
      11. add-sqr-sqrt5.6%

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

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}} \cdot x}{-t} \]
      13. sqr-neg11.8%

        \[\leadsto \frac{\sqrt{\color{blue}{z \cdot z}} \cdot x}{-t} \]
      14. sqrt-unprod0.0%

        \[\leadsto \frac{\color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \cdot x}{-t} \]
      15. add-sqr-sqrt51.9%

        \[\leadsto \frac{\color{blue}{z} \cdot x}{-t} \]
    12. Applied egg-rr51.9%

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

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

        \[\leadsto \color{blue}{\frac{z}{-t} \cdot x} \]
    14. Simplified64.6%

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

    if -1.1499999999999999e89 < z < 2.4e104

    1. Initial program 98.3%

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

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

    if 2.4e104 < z

    1. Initial program 82.1%

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

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

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

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

Alternative 10: 97.4% accurate, 1.0× speedup?

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

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

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

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

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

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

Alternative 11: 97.4% accurate, 1.0× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z}{t}, y - x, x\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. fma-udef97.5%

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

      \[\leadsto \color{blue}{\left(y - x\right) \cdot \frac{z}{t}} + x \]
  6. Applied egg-rr97.5%

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

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

Alternative 12: 38.9% 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 94.0%

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

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

    \[\leadsto x \]
  5. Add Preprocessing

Developer target: 97.6% accurate, 0.5× 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 2024019 
(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)))