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

Percentage Accurate: 92.6% → 97.7%
Time: 10.3s
Alternatives: 11
Speedup: 1.0×

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 11 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.6% 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: 97.7% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
  6. Step-by-step derivation
    1. clear-num97.9%

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

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

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

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

Alternative 2: 85.3% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.1499999999999999e-35 or 3.4999999999999998e-10 < t

    1. Initial program 83.0%

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

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

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

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

    if -1.1499999999999999e-35 < t < 3.4999999999999998e-10

    1. Initial program 97.5%

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

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

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

Alternative 3: 84.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{-35} \lor \neg \left(t \leq 6 \cdot 10^{-10}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.1999999999999998e-35 or 6e-10 < t

    1. Initial program 83.0%

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

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

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

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

    if -3.1999999999999998e-35 < t < 6e-10

    1. Initial program 97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 75.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{-50} \lor \neg \left(y \leq 2.3 \cdot 10^{-123}\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 -9e-50) (not (<= y 2.3e-123)))
   (* (- z x) (/ y t))
   (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -9e-50) || !(y <= 2.3e-123)) {
		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 <= (-9d-50)) .or. (.not. (y <= 2.3d-123))) 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 <= -9e-50) || !(y <= 2.3e-123)) {
		tmp = (z - x) * (y / t);
	} else {
		tmp = x * (1.0 - (y / t));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= -9e-50) or not (y <= 2.3e-123):
		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 <= -9e-50) || !(y <= 2.3e-123))
		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 <= -9e-50) || ~((y <= 2.3e-123)))
		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, -9e-50], N[Not[LessEqual[y, 2.3e-123]], $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 -9 \cdot 10^{-50} \lor \neg \left(y \leq 2.3 \cdot 10^{-123}\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 < -8.99999999999999924e-50 or 2.29999999999999987e-123 < y

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.99999999999999924e-50 < y < 2.29999999999999987e-123

    1. Initial program 96.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{-50} \lor \neg \left(y \leq 2.3 \cdot 10^{-123}\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 5: 74.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+133} \lor \neg \left(z \leq 8.5 \cdot 10^{+61}\right):\\
\;\;\;\;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.9999999999999997e133 or 8.50000000000000035e61 < z

    1. Initial program 82.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{t}{z}}} \]
    8. Applied egg-rr74.2%

      \[\leadsto \color{blue}{\frac{y}{\frac{t}{z}}} \]
    9. Step-by-step derivation
      1. associate-/r/78.8%

        \[\leadsto \color{blue}{\frac{y}{t} \cdot z} \]
    10. Applied egg-rr78.8%

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

    if -8.9999999999999997e133 < z < 8.50000000000000035e61

    1. Initial program 94.2%

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

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

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

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

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

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

Alternative 6: 84.5% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;y \leq 730000:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4e13

    1. Initial program 81.4%

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

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

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

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

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

    if -4e13 < y < 7.3e5

    1. Initial program 97.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.3e5 < y

    1. Initial program 85.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 76.1% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.39999999999999999e-49

    1. Initial program 85.2%

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

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

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

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

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

    if -1.39999999999999999e-49 < y < 1e-107

    1. Initial program 96.6%

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

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

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

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

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

    if 1e-107 < 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.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 55.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-50} \lor \neg \left(y \leq 1.2 \cdot 10^{-116}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.80000000000000004e-50 or 1.19999999999999996e-116 < y

    1. Initial program 86.7%

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    7. Step-by-step derivation
      1. clear-num50.8%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{t}{z}}} \]
    8. Applied egg-rr51.1%

      \[\leadsto \color{blue}{\frac{y}{\frac{t}{z}}} \]
    9. Step-by-step derivation
      1. associate-/r/54.0%

        \[\leadsto \color{blue}{\frac{y}{t} \cdot z} \]
    10. Applied egg-rr54.0%

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

    if -4.80000000000000004e-50 < y < 1.19999999999999996e-116

    1. Initial program 96.6%

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

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

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

Alternative 9: 54.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{-49} \lor \neg \left(y \leq 7.4 \cdot 10^{-96}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.65e-49 or 7.39999999999999972e-96 < y

    1. Initial program 86.5%

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

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

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

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

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

    if -1.65e-49 < y < 7.39999999999999972e-96

    1. Initial program 96.7%

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

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

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

Alternative 10: 97.7% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 38.9% accurate, 9.0× speedup?

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

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

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

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

Developer Target 1: 91.0% 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 2024131 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
  :precision binary64

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

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