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

Percentage Accurate: 93.0% → 97.4%
Time: 10.0s
Alternatives: 10
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 10 alternatives:

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

Initial Program: 93.0% 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.4% accurate, 1.0× speedup?

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

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

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

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

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

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

Alternative 2: 71.9% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-123} \lor \neg \left(x \leq 1.02 \cdot 10^{-218}\right) \land \left(x \leq 4 \cdot 10^{-111} \lor \neg \left(x \leq 4 \cdot 10^{-35}\right)\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.99999999999999986e-123 or 1.02e-218 < x < 4.00000000000000035e-111 or 4.00000000000000003e-35 < x

    1. Initial program 93.2%

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

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

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

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

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

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

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

    if -8.99999999999999986e-123 < x < 1.02e-218 or 4.00000000000000035e-111 < x < 4.00000000000000003e-35

    1. Initial program 92.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9 \cdot 10^{-123} \lor \neg \left(x \leq 1.02 \cdot 10^{-218}\right) \land \left(x \leq 4 \cdot 10^{-111} \lor \neg \left(x \leq 4 \cdot 10^{-35}\right)\right):\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 84.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{if}\;x \leq -7.6 \cdot 10^{+114}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -9 \cdot 10^{+77}:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \mathbf{elif}\;x \leq -55000000000 \lor \neg \left(x \leq 9.5 \cdot 10^{+28}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- 1.0 (/ y t)))))
   (if (<= x -7.6e+114)
     t_1
     (if (<= x -9e+77)
       (+ x (* (/ y t) z))
       (if (or (<= x -55000000000.0) (not (<= x 9.5e+28)))
         t_1
         (+ x (/ y (/ t z))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - (y / t));
	double tmp;
	if (x <= -7.6e+114) {
		tmp = t_1;
	} else if (x <= -9e+77) {
		tmp = x + ((y / t) * z);
	} else if ((x <= -55000000000.0) || !(x <= 9.5e+28)) {
		tmp = t_1;
	} else {
		tmp = x + (y / (t / z));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * (1.0d0 - (y / t))
    if (x <= (-7.6d+114)) then
        tmp = t_1
    else if (x <= (-9d+77)) then
        tmp = x + ((y / t) * z)
    else if ((x <= (-55000000000.0d0)) .or. (.not. (x <= 9.5d+28))) then
        tmp = t_1
    else
        tmp = x + (y / (t / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - (y / t));
	double tmp;
	if (x <= -7.6e+114) {
		tmp = t_1;
	} else if (x <= -9e+77) {
		tmp = x + ((y / t) * z);
	} else if ((x <= -55000000000.0) || !(x <= 9.5e+28)) {
		tmp = t_1;
	} else {
		tmp = x + (y / (t / z));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (1.0 - (y / t))
	tmp = 0
	if x <= -7.6e+114:
		tmp = t_1
	elif x <= -9e+77:
		tmp = x + ((y / t) * z)
	elif (x <= -55000000000.0) or not (x <= 9.5e+28):
		tmp = t_1
	else:
		tmp = x + (y / (t / z))
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(1.0 - Float64(y / t)))
	tmp = 0.0
	if (x <= -7.6e+114)
		tmp = t_1;
	elseif (x <= -9e+77)
		tmp = Float64(x + Float64(Float64(y / t) * z));
	elseif ((x <= -55000000000.0) || !(x <= 9.5e+28))
		tmp = t_1;
	else
		tmp = Float64(x + Float64(y / Float64(t / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (1.0 - (y / t));
	tmp = 0.0;
	if (x <= -7.6e+114)
		tmp = t_1;
	elseif (x <= -9e+77)
		tmp = x + ((y / t) * z);
	elseif ((x <= -55000000000.0) || ~((x <= 9.5e+28)))
		tmp = t_1;
	else
		tmp = x + (y / (t / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.6e+114], t$95$1, If[LessEqual[x, -9e+77], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -55000000000.0], N[Not[LessEqual[x, 9.5e+28]], $MachinePrecision]], t$95$1, N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -9 \cdot 10^{+77}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\

\mathbf{elif}\;x \leq -55000000000 \lor \neg \left(x \leq 9.5 \cdot 10^{+28}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -7.6000000000000001e114 or -9.00000000000000049e77 < x < -5.5e10 or 9.49999999999999927e28 < x

    1. Initial program 93.3%

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

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

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

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

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

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

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

    if -7.6000000000000001e114 < x < -9.00000000000000049e77

    1. Initial program 89.6%

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

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

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

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

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

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

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

    if -5.5e10 < x < 9.49999999999999927e28

    1. Initial program 92.8%

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

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

      \[\leadsto \color{blue}{x + \frac{y}{\frac{t}{z - x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 88.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.6 \cdot 10^{+114}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{elif}\;x \leq -9 \cdot 10^{+77}:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \mathbf{elif}\;x \leq -55000000000 \lor \neg \left(x \leq 9.5 \cdot 10^{+28}\right):\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 49.8% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;t \leq -2.7 \cdot 10^{+28}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq -8 \cdot 10^{-280}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;t \leq 2.2 \cdot 10^{+190}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.7000000000000002e28 or 2.2e190 < t

    1. Initial program 88.3%

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

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

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

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

    if -2.7000000000000002e28 < t < -7.9999999999999997e-280 or 5.5000000000000001e-191 < t < 2.2e190

    1. Initial program 94.9%

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

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

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

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

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

    if -7.9999999999999997e-280 < t < 5.5000000000000001e-191

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\frac{y \cdot x}{t}} \]
      4. associate-*r/64.5%

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

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

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

        \[\leadsto y \cdot \color{blue}{\frac{-x}{t}} \]
    10. Simplified64.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.7 \cdot 10^{+28}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -8 \cdot 10^{-280}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{elif}\;t \leq 5.5 \cdot 10^{-191}:\\ \;\;\;\;\frac{x}{t} \cdot \left(-y\right)\\ \mathbf{elif}\;t \leq 2.2 \cdot 10^{+190}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 50.5% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;t \leq -1.35 \cdot 10^{+29}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq -1.35 \cdot 10^{-246}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;t \leq 2.2 \cdot 10^{+190}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.35e29 or 2.2e190 < t

    1. Initial program 88.3%

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

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

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

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

    if -1.35e29 < t < -1.3499999999999999e-246 or 1.4799999999999999e-71 < t < 2.2e190

    1. Initial program 94.4%

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

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

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

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

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

    if -1.3499999999999999e-246 < t < 1.4799999999999999e-71

    1. Initial program 96.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\frac{y \cdot x}{t}} \]
      4. associate-*r/52.9%

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

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

        \[\leadsto \color{blue}{y \cdot \left(-\frac{x}{t}\right)} \]
      7. distribute-neg-frac52.9%

        \[\leadsto y \cdot \color{blue}{\frac{-x}{t}} \]
    10. Simplified52.9%

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

        \[\leadsto \color{blue}{\frac{y \cdot \left(-x\right)}{t}} \]
      2. add-sqr-sqrt28.0%

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

        \[\leadsto \frac{y \cdot \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{t} \]
      4. sqr-neg28.3%

        \[\leadsto \frac{y \cdot \sqrt{\color{blue}{x \cdot x}}}{t} \]
      5. sqrt-unprod2.2%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{t}{y}}} \]
      9. frac-2neg4.7%

        \[\leadsto \color{blue}{\frac{-x}{-\frac{t}{y}}} \]
      10. add-sqr-sqrt2.4%

        \[\leadsto \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{-\frac{t}{y}} \]
      11. sqrt-unprod28.6%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{-\frac{t}{y}} \]
      12. sqr-neg28.6%

        \[\leadsto \frac{\sqrt{\color{blue}{x \cdot x}}}{-\frac{t}{y}} \]
      13. sqrt-unprod29.6%

        \[\leadsto \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-\frac{t}{y}} \]
      14. add-sqr-sqrt60.5%

        \[\leadsto \frac{\color{blue}{x}}{-\frac{t}{y}} \]
    12. Applied egg-rr60.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.35 \cdot 10^{+29}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.35 \cdot 10^{-246}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{elif}\;t \leq 1.48 \cdot 10^{-71}:\\ \;\;\;\;\frac{x}{\frac{-t}{y}}\\ \mathbf{elif}\;t \leq 2.2 \cdot 10^{+190}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 77.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+25} \lor \neg \left(y \leq 160\right):\\
\;\;\;\;y \cdot \frac{z - x}{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 < -3.39999999999999984e25 or 160 < y

    1. Initial program 89.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(\frac{z}{t} + \color{blue}{\left(-\frac{x}{t}\right) \cdot 1}\right) \]
      12. cancel-sign-sub-inv86.2%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{z - x}{t}} \]
    8. Simplified86.9%

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

    if -3.39999999999999984e25 < y < 160

    1. Initial program 96.8%

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

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

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

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

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

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

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

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

Alternative 7: 85.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{+115} \lor \neg \left(x \leq 1.1 \cdot 10^{+27}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.4000000000000001e115 or 1.0999999999999999e27 < x

    1. Initial program 93.3%

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

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

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

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

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

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

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

    if -4.4000000000000001e115 < x < 1.0999999999999999e27

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

Alternative 8: 85.0% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.19999999999999989e-63 or 3.5499999999999998e-72 < t

    1. Initial program 90.9%

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

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

      \[\leadsto \color{blue}{x + \frac{y}{\frac{t}{z - x}}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 89.5%

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

    if -3.19999999999999989e-63 < t < 3.5499999999999998e-72

    1. Initial program 96.1%

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

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

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

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

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

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

Alternative 9: 50.3% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.1e30 or 2.2e190 < t

    1. Initial program 88.3%

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

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

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

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

    if -2.1e30 < t < 2.2e190

    1. Initial program 95.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.1 \cdot 10^{+30}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 2.2 \cdot 10^{+190}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 39.1% 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. Step-by-step derivation
    1. associate-*l/96.5%

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

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

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

    \[\leadsto x \]
  7. Add Preprocessing

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

  :herbie-target
  (- x (+ (* x (/ y t)) (* (- z) (/ y t))))

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