Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D

Percentage Accurate: 92.9% → 98.3%
Time: 8.6s
Alternatives: 12
Speedup: 0.3×

Specification

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

\\
x + \frac{y \cdot \left(z - x\right)}{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.9% accurate, 1.0× speedup?

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

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

Alternative 1: 98.3% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;x + {\left(\frac{\frac{t}{z - x}}{y}\right)}^{-1}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+275}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{z - x}{t}, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (/ (* y (- z x)) t))))
   (if (<= t_1 (- INFINITY))
     (+ x (pow (/ (/ t (- z x)) y) -1.0))
     (if (<= t_1 2e+275) t_1 (fma y (/ (- z x) t) x)))))
double code(double x, double y, double z, double t) {
	double t_1 = x + ((y * (z - x)) / t);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = x + pow(((t / (z - x)) / y), -1.0);
	} else if (t_1 <= 2e+275) {
		tmp = t_1;
	} else {
		tmp = fma(y, ((z - x) / t), x);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(x + Float64(Float64(y * Float64(z - x)) / t))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(x + (Float64(Float64(t / Float64(z - x)) / y) ^ -1.0));
	elseif (t_1 <= 2e+275)
		tmp = t_1;
	else
		tmp = fma(y, Float64(Float64(z - x) / t), x);
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + N[Power[N[(N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+275], t$95$1, N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+275}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - x}{t}, x\right)\\


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

    1. Initial program 83.1%

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

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

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

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

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

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

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

    1. Initial program 99.3%

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

    if 1.99999999999999992e275 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t))

    1. Initial program 75.1%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{z - x}{t}, x\right)} \]
    4. Add Preprocessing
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 98.3% accurate, 0.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


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

    1. Initial program 78.5%

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

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

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

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

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

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

    1. Initial program 99.3%

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

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

Alternative 3: 96.2% accurate, 0.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


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

    1. Initial program 77.6%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot y}{t} + \frac{y \cdot z}{t}} \]
    5. Step-by-step derivation
      1. +-commutative62.9%

        \[\leadsto \color{blue}{\frac{y \cdot z}{t} + -1 \cdot \frac{x \cdot y}{t}} \]
      2. *-commutative62.9%

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

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} + -1 \cdot \frac{x \cdot y}{t} \]
      4. mul-1-neg74.2%

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

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

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

        \[\leadsto \color{blue}{\frac{y}{t} \cdot \left(z + \left(-x\right)\right)} \]
      8. sub-neg94.9%

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

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

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

    1. Initial program 99.3%

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

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

Alternative 4: 54.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \frac{y}{t}\\ \mathbf{if}\;y \leq -5.9 \cdot 10^{+26}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{-7}:\\ \;\;\;\;y \cdot \frac{-x}{t}\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+68}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+251}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-y}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (/ y t))))
   (if (<= y -5.9e+26)
     t_1
     (if (<= y -6.2e-7)
       (* y (/ (- x) t))
       (if (<= y 1.1e+68) x (if (<= y 4.2e+251) t_1 (* x (/ (- y) t))))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (y / t);
	double tmp;
	if (y <= -5.9e+26) {
		tmp = t_1;
	} else if (y <= -6.2e-7) {
		tmp = y * (-x / t);
	} else if (y <= 1.1e+68) {
		tmp = x;
	} else if (y <= 4.2e+251) {
		tmp = t_1;
	} else {
		tmp = x * (-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 = z * (y / t)
    if (y <= (-5.9d+26)) then
        tmp = t_1
    else if (y <= (-6.2d-7)) then
        tmp = y * (-x / t)
    else if (y <= 1.1d+68) then
        tmp = x
    else if (y <= 4.2d+251) then
        tmp = t_1
    else
        tmp = x * (-y / t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = z * (y / t);
	double tmp;
	if (y <= -5.9e+26) {
		tmp = t_1;
	} else if (y <= -6.2e-7) {
		tmp = y * (-x / t);
	} else if (y <= 1.1e+68) {
		tmp = x;
	} else if (y <= 4.2e+251) {
		tmp = t_1;
	} else {
		tmp = x * (-y / t);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (y / t)
	tmp = 0
	if y <= -5.9e+26:
		tmp = t_1
	elif y <= -6.2e-7:
		tmp = y * (-x / t)
	elif y <= 1.1e+68:
		tmp = x
	elif y <= 4.2e+251:
		tmp = t_1
	else:
		tmp = x * (-y / t)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(y / t))
	tmp = 0.0
	if (y <= -5.9e+26)
		tmp = t_1;
	elseif (y <= -6.2e-7)
		tmp = Float64(y * Float64(Float64(-x) / t));
	elseif (y <= 1.1e+68)
		tmp = x;
	elseif (y <= 4.2e+251)
		tmp = t_1;
	else
		tmp = Float64(x * Float64(Float64(-y) / t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * (y / t);
	tmp = 0.0;
	if (y <= -5.9e+26)
		tmp = t_1;
	elseif (y <= -6.2e-7)
		tmp = y * (-x / t);
	elseif (y <= 1.1e+68)
		tmp = x;
	elseif (y <= 4.2e+251)
		tmp = t_1;
	else
		tmp = x * (-y / t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.9e+26], t$95$1, If[LessEqual[y, -6.2e-7], N[(y * N[((-x) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e+68], x, If[LessEqual[y, 4.2e+251], t$95$1, N[(x * N[((-y) / t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;y \leq -5.9 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -6.2 \cdot 10^{-7}:\\
\;\;\;\;y \cdot \frac{-x}{t}\\

\mathbf{elif}\;y \leq 1.1 \cdot 10^{+68}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 4.2 \cdot 10^{+251}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -5.9000000000000003e26 or 1.09999999999999994e68 < y < 4.2000000000000001e251

    1. Initial program 88.4%

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

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

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

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

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{t}} \]
    6. Simplified63.3%

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

    if -5.9000000000000003e26 < y < -6.1999999999999999e-7

    1. Initial program 99.7%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot y}{t}} \]
    7. Step-by-step derivation
      1. mul-1-neg89.6%

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

        \[\leadsto -\color{blue}{\frac{x}{t} \cdot y} \]
      3. *-commutative89.6%

        \[\leadsto -\color{blue}{y \cdot \frac{x}{t}} \]
      4. distribute-rgt-neg-in89.6%

        \[\leadsto \color{blue}{y \cdot \left(-\frac{x}{t}\right)} \]
      5. distribute-neg-frac89.6%

        \[\leadsto y \cdot \color{blue}{\frac{-x}{t}} \]
    8. Simplified89.6%

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

    if -6.1999999999999999e-7 < y < 1.09999999999999994e68

    1. Initial program 97.8%

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

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

    if 4.2000000000000001e251 < y

    1. Initial program 74.8%

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

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

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

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\left(x \cdot \frac{y}{t}\right)} \]
      2. associate-*r*73.4%

        \[\leadsto \color{blue}{\left(-1 \cdot x\right) \cdot \frac{y}{t}} \]
      3. neg-mul-173.4%

        \[\leadsto \color{blue}{\left(-x\right)} \cdot \frac{y}{t} \]
      4. *-commutative73.4%

        \[\leadsto \color{blue}{\frac{y}{t} \cdot \left(-x\right)} \]
    8. Simplified73.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.9 \cdot 10^{+26}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{-7}:\\ \;\;\;\;y \cdot \frac{-x}{t}\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+68}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+251}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-y}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 55.0% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;y \leq -1.22 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -6.2 \cdot 10^{-7}:\\
\;\;\;\;y \cdot \frac{-x}{t}\\

\mathbf{elif}\;y \leq 4.1 \cdot 10^{+67}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.2200000000000001e27 or 4.09999999999999979e67 < y

    1. Initial program 86.6%

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

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

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

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

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{t}} \]
    6. Simplified61.0%

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

    if -1.2200000000000001e27 < y < -6.1999999999999999e-7

    1. Initial program 99.7%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot y}{t}} \]
    7. Step-by-step derivation
      1. mul-1-neg89.6%

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

        \[\leadsto -\color{blue}{\frac{x}{t} \cdot y} \]
      3. *-commutative89.6%

        \[\leadsto -\color{blue}{y \cdot \frac{x}{t}} \]
      4. distribute-rgt-neg-in89.6%

        \[\leadsto \color{blue}{y \cdot \left(-\frac{x}{t}\right)} \]
      5. distribute-neg-frac89.6%

        \[\leadsto y \cdot \color{blue}{\frac{-x}{t}} \]
    8. Simplified89.6%

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

    if -6.1999999999999999e-7 < y < 4.09999999999999979e67

    1. Initial program 97.8%

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 86.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{-81} \lor \neg \left(z \leq 4 \cdot 10^{-91}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -8.19999999999999968e-81 or 4.00000000000000009e-91 < z

    1. Initial program 92.2%

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

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

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

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

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

    if -8.19999999999999968e-81 < z < 4.00000000000000009e-91

    1. Initial program 94.2%

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

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

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

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

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

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

Alternative 7: 83.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{-79} \lor \neg \left(z \leq 2.6 \cdot 10^{-96}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.5000000000000003e-79 or 2.6000000000000002e-96 < z

    1. Initial program 92.2%

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

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

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

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

    if -3.5000000000000003e-79 < z < 2.6000000000000002e-96

    1. Initial program 94.2%

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

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

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

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

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

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

Alternative 8: 76.1% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.9000000000000003e-42 or 4.4999999999999998e66 < y

    1. Initial program 88.0%

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot z}{t} + -1 \cdot \frac{x \cdot y}{t}} \]
      2. *-commutative70.4%

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

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} + -1 \cdot \frac{x \cdot y}{t} \]
      4. mul-1-neg76.3%

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

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

        \[\leadsto z \cdot \frac{y}{t} + \color{blue}{\left(-x\right) \cdot \frac{y}{t}} \]
      7. distribute-rgt-in87.8%

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

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

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

    if -2.9000000000000003e-42 < y < 4.4999999999999998e66

    1. Initial program 97.7%

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

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

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

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

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

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

Alternative 9: 72.8% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;z \leq 4 \cdot 10^{+149}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


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

    1. Initial program 87.0%

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

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

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z}{t}} \]
    6. Simplified76.6%

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

    if -7.0999999999999997e161 < z < 4.0000000000000002e149

    1. Initial program 95.4%

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

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

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

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

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

    if 4.0000000000000002e149 < z

    1. Initial program 86.1%

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

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

      \[\leadsto \color{blue}{\frac{y \cdot z}{t}} \]
    5. Step-by-step derivation
      1. *-commutative78.8%

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

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{t}} \]
    6. Simplified70.9%

      \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 10: 55.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-39} \lor \neg \left(y \leq 1.05 \cdot 10^{+68}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.5e-39 or 1.05e68 < y

    1. Initial program 87.9%

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

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

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

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

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{t}} \]
    6. Simplified57.7%

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

    if -3.5e-39 < y < 1.05e68

    1. Initial program 97.7%

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

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

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

Alternative 11: 54.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{-39} \lor \neg \left(y \leq 4.5 \cdot 10^{+67}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.1e-39 or 4.4999999999999998e67 < y

    1. Initial program 87.9%

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

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

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z}{t}} \]
    6. Simplified54.3%

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

    if -4.1e-39 < y < 4.4999999999999998e67

    1. Initial program 97.7%

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

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

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

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

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

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

Developer target: 91.2% accurate, 0.6× speedup?

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

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

Reproduce

?
herbie shell --seed 2024096 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
  :precision binary64

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

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