Numeric.Histogram:binBounds from Chart-1.5.3

Percentage Accurate: 92.8% → 98.7%
Time: 8.4s
Alternatives: 10
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 10 alternatives:

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

Initial Program: 92.8% 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: 98.7% 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 5 \cdot 10^{+292}\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 5e+292)))
     (+ 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 <= 5e+292)) {
		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 <= 5e+292)) {
		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 <= 5e+292):
		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 <= 5e+292))
		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 <= 5e+292)))
		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, 5e+292]], $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 5 \cdot 10^{+292}\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 4.9999999999999996e292 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t))

    1. Initial program 67.7%

      \[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)) < 4.9999999999999996e292

    1. Initial program 99.2%

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

    \[\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 5 \cdot 10^{+292}\right):\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z \cdot \left(y - x\right)}{t}\\ \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 89.1%

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

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

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

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

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

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

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

Alternative 3: 73.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{if}\;x \leq -2.55 \cdot 10^{-48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-162}:\\ \;\;\;\;\frac{z}{t} \cdot y\\ \mathbf{elif}\;x \leq 5.1 \cdot 10^{+31} \lor \neg \left(x \leq 7.8 \cdot 10^{+43}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- 1.0 (/ z t)))))
   (if (<= x -2.55e-48)
     t_1
     (if (<= x 3.2e-162)
       (* (/ z t) y)
       (if (or (<= x 5.1e+31) (not (<= x 7.8e+43))) t_1 (* z (/ y t)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - (z / t));
	double tmp;
	if (x <= -2.55e-48) {
		tmp = t_1;
	} else if (x <= 3.2e-162) {
		tmp = (z / t) * y;
	} else if ((x <= 5.1e+31) || !(x <= 7.8e+43)) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_1 = x * (1.0d0 - (z / t))
    if (x <= (-2.55d-48)) then
        tmp = t_1
    else if (x <= 3.2d-162) then
        tmp = (z / t) * y
    else if ((x <= 5.1d+31) .or. (.not. (x <= 7.8d+43))) then
        tmp = t_1
    else
        tmp = z * (y / t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - (z / t));
	double tmp;
	if (x <= -2.55e-48) {
		tmp = t_1;
	} else if (x <= 3.2e-162) {
		tmp = (z / t) * y;
	} else if ((x <= 5.1e+31) || !(x <= 7.8e+43)) {
		tmp = t_1;
	} else {
		tmp = z * (y / t);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (1.0 - (z / t))
	tmp = 0
	if x <= -2.55e-48:
		tmp = t_1
	elif x <= 3.2e-162:
		tmp = (z / t) * y
	elif (x <= 5.1e+31) or not (x <= 7.8e+43):
		tmp = t_1
	else:
		tmp = z * (y / t)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(1.0 - Float64(z / t)))
	tmp = 0.0
	if (x <= -2.55e-48)
		tmp = t_1;
	elseif (x <= 3.2e-162)
		tmp = Float64(Float64(z / t) * y);
	elseif ((x <= 5.1e+31) || !(x <= 7.8e+43))
		tmp = t_1;
	else
		tmp = Float64(z * Float64(y / t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (1.0 - (z / t));
	tmp = 0.0;
	if (x <= -2.55e-48)
		tmp = t_1;
	elseif (x <= 3.2e-162)
		tmp = (z / t) * y;
	elseif ((x <= 5.1e+31) || ~((x <= 7.8e+43)))
		tmp = t_1;
	else
		tmp = z * (y / t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.55e-48], t$95$1, If[LessEqual[x, 3.2e-162], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision], If[Or[LessEqual[x, 5.1e+31], N[Not[LessEqual[x, 7.8e+43]], $MachinePrecision]], t$95$1, N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;x \leq -2.55 \cdot 10^{-48}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 3.2 \cdot 10^{-162}:\\
\;\;\;\;\frac{z}{t} \cdot y\\

\mathbf{elif}\;x \leq 5.1 \cdot 10^{+31} \lor \neg \left(x \leq 7.8 \cdot 10^{+43}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.55000000000000006e-48 or 3.19999999999999975e-162 < x < 5.0999999999999997e31 or 7.8000000000000001e43 < x

    1. Initial program 87.0%

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

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

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

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

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

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

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

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

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

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

    if -2.55000000000000006e-48 < x < 3.19999999999999975e-162

    1. Initial program 92.4%

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

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

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

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

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

    if 5.0999999999999997e31 < x < 7.8000000000000001e43

    1. Initial program 99.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.55 \cdot 10^{-48}:\\ \;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-162}:\\ \;\;\;\;\frac{z}{t} \cdot y\\ \mathbf{elif}\;x \leq 5.1 \cdot 10^{+31} \lor \neg \left(x \leq 7.8 \cdot 10^{+43}\right):\\ \;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \end{array} \]

Alternative 4: 55.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -2.25 \cdot 10^{+89}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -4.6 \cdot 10^{-95} \lor \neg \left(t \leq -3.45 \cdot 10^{-121}\right) \land t \leq 1.55 \cdot 10^{+65}:\\ \;\;\;\;\frac{z}{t} \cdot y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -2.25e+89)
   x
   (if (or (<= t -4.6e-95) (and (not (<= t -3.45e-121)) (<= t 1.55e+65)))
     (* (/ z t) y)
     x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -2.25e+89) {
		tmp = x;
	} else if ((t <= -4.6e-95) || (!(t <= -3.45e-121) && (t <= 1.55e+65))) {
		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 (t <= (-2.25d+89)) then
        tmp = x
    else if ((t <= (-4.6d-95)) .or. (.not. (t <= (-3.45d-121))) .and. (t <= 1.55d+65)) 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 (t <= -2.25e+89) {
		tmp = x;
	} else if ((t <= -4.6e-95) || (!(t <= -3.45e-121) && (t <= 1.55e+65))) {
		tmp = (z / t) * y;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -2.25e+89:
		tmp = x
	elif (t <= -4.6e-95) or (not (t <= -3.45e-121) and (t <= 1.55e+65)):
		tmp = (z / t) * y
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -2.25e+89)
		tmp = x;
	elseif ((t <= -4.6e-95) || (!(t <= -3.45e-121) && (t <= 1.55e+65)))
		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 (t <= -2.25e+89)
		tmp = x;
	elseif ((t <= -4.6e-95) || (~((t <= -3.45e-121)) && (t <= 1.55e+65)))
		tmp = (z / t) * y;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.25e+89], x, If[Or[LessEqual[t, -4.6e-95], And[N[Not[LessEqual[t, -3.45e-121]], $MachinePrecision], LessEqual[t, 1.55e+65]]], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision], x]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -4.6 \cdot 10^{-95} \lor \neg \left(t \leq -3.45 \cdot 10^{-121}\right) \land t \leq 1.55 \cdot 10^{+65}:\\
\;\;\;\;\frac{z}{t} \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.25e89 or -4.59999999999999998e-95 < t < -3.45e-121 or 1.54999999999999995e65 < t

    1. Initial program 76.7%

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

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

    if -2.25e89 < t < -4.59999999999999998e-95 or -3.45e-121 < t < 1.54999999999999995e65

    1. Initial program 97.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.25 \cdot 10^{+89}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -4.6 \cdot 10^{-95} \lor \neg \left(t \leq -3.45 \cdot 10^{-121}\right) \land t \leq 1.55 \cdot 10^{+65}:\\ \;\;\;\;\frac{z}{t} \cdot y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 5: 52.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+200}:\\
\;\;\;\;\frac{x}{t} \cdot \left(-z\right)\\

\mathbf{elif}\;z \leq -1.9 \cdot 10^{-69}:\\
\;\;\;\;z \cdot \frac{y}{t}\\

\mathbf{elif}\;z \leq 7.8 \cdot 10^{-137}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -7.00000000000000013e200

    1. Initial program 73.2%

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

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

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

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

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

        \[\leadsto x + x \cdot \color{blue}{\left(-\frac{z}{t}\right)} \]
      5. distribute-rgt-neg-in92.0%

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

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

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\left(z \cdot \frac{x}{t}\right)} \]
      2. neg-mul-161.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 -7.00000000000000013e200 < z < -1.8999999999999999e-69

    1. Initial program 81.8%

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

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

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

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

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

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

    if -1.8999999999999999e-69 < z < 7.7999999999999999e-137

    1. Initial program 98.9%

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

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

    if 7.7999999999999999e-137 < z

    1. Initial program 87.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7 \cdot 10^{+200}:\\ \;\;\;\;\frac{x}{t} \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -1.9 \cdot 10^{-69}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{-137}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{t} \cdot y\\ \end{array} \]

Alternative 6: 53.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+189}:\\
\;\;\;\;\frac{z}{t} \cdot \left(-x\right)\\

\mathbf{elif}\;z \leq -1.2 \cdot 10^{-67}:\\
\;\;\;\;z \cdot \frac{y}{t}\\

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-137}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -9.49999999999999911e189

    1. Initial program 65.8%

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

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

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

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

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

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

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

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

    if -9.49999999999999911e189 < z < -1.2e-67

    1. Initial program 86.5%

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

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

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

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

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

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

    if -1.2e-67 < z < 6.49999999999999991e-137

    1. Initial program 98.9%

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

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

    if 6.49999999999999991e-137 < z

    1. Initial program 87.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{+189}:\\ \;\;\;\;\frac{z}{t} \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-67}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-137}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{t} \cdot y\\ \end{array} \]

Alternative 7: 85.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-19} \lor \neg \left(y \leq 7.4 \cdot 10^{-152}\right):\\
\;\;\;\;x + \frac{z}{t} \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.1999999999999998e-19 or 7.3999999999999997e-152 < y

    1. Initial program 88.5%

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

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

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

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

    if -6.1999999999999998e-19 < y < 7.3999999999999997e-152

    1. Initial program 90.5%

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

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

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

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

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

        \[\leadsto x + x \cdot \color{blue}{\left(-\frac{z}{t}\right)} \]
      5. distribute-rgt-neg-in91.6%

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

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

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

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

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

Alternative 8: 93.4% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.8000000000000005e82

    1. Initial program 79.1%

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

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

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

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

    if -8.8000000000000005e82 < y

    1. Initial program 93.2%

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

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

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

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

Alternative 9: 97.8% 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 89.1%

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

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

    \[\leadsto \color{blue}{x + \frac{y - x}{\frac{t}{z}}} \]
  4. Final simplification98.7%

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

Alternative 10: 37.4% 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 89.1%

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

    \[\leadsto \color{blue}{x} \]
  3. Final simplification36.9%

    \[\leadsto x \]

Developer target: 97.8% 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 2023238 
(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)))