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

Percentage Accurate: 92.2% → 97.9%
Time: 9.4s
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.2% 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.9% 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.6%

    \[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. *-commutative85.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 54.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \frac{z}{t}\\ \mathbf{if}\;y \leq -4.4 \cdot 10^{+60}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-21}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9 \cdot 10^{+117}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{-t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (/ z t))))
   (if (<= y -4.4e+60)
     t_1
     (if (<= y 5.4e-21) x (if (<= y 9e+117) t_1 (* x (/ y (- t))))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (z / t);
	double tmp;
	if (y <= -4.4e+60) {
		tmp = t_1;
	} else if (y <= 5.4e-21) {
		tmp = x;
	} else if (y <= 9e+117) {
		tmp = t_1;
	} else {
		tmp = x * (y / -t);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = y * (z / t)
    if (y <= (-4.4d+60)) then
        tmp = t_1
    else if (y <= 5.4d-21) then
        tmp = x
    else if (y <= 9d+117) then
        tmp = t_1
    else
        tmp = x * (y / -t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = y * (z / t);
	double tmp;
	if (y <= -4.4e+60) {
		tmp = t_1;
	} else if (y <= 5.4e-21) {
		tmp = x;
	} else if (y <= 9e+117) {
		tmp = t_1;
	} else {
		tmp = x * (y / -t);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (z / t)
	tmp = 0
	if y <= -4.4e+60:
		tmp = t_1
	elif y <= 5.4e-21:
		tmp = x
	elif y <= 9e+117:
		tmp = t_1
	else:
		tmp = x * (y / -t)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(z / t))
	tmp = 0.0
	if (y <= -4.4e+60)
		tmp = t_1;
	elseif (y <= 5.4e-21)
		tmp = x;
	elseif (y <= 9e+117)
		tmp = t_1;
	else
		tmp = Float64(x * Float64(y / Float64(-t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (z / t);
	tmp = 0.0;
	if (y <= -4.4e+60)
		tmp = t_1;
	elseif (y <= 5.4e-21)
		tmp = x;
	elseif (y <= 9e+117)
		tmp = t_1;
	else
		tmp = x * (y / -t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.4e+60], t$95$1, If[LessEqual[y, 5.4e-21], x, If[LessEqual[y, 9e+117], t$95$1, N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 5.4 \cdot 10^{-21}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 9 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.39999999999999992e60 or 5.4000000000000002e-21 < y < 9e117

    1. Initial program 81.0%

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

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

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

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

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

    if -4.39999999999999992e60 < y < 5.4000000000000002e-21

    1. Initial program 98.4%

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

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

    if 9e117 < y

    1. Initial program 85.8%

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

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

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

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

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

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

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

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

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

Alternative 3: 86.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{+63}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

\mathbf{elif}\;x \leq 2.55 \cdot 10^{+51}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.00000000000000023e63

    1. Initial program 80.0%

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

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

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

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

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

    if -4.00000000000000023e63 < x < 2.55000000000000005e51

    1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + \color{blue}{\frac{z - x}{\frac{t}{y}}} \]
    9. Taylor expanded in z around inf 87.0%

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

    if 2.55000000000000005e51 < x

    1. Initial program 93.1%

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

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

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

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

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

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

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

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

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

Alternative 4: 86.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+63} \lor \neg \left(x \leq 1.4 \cdot 10^{+51}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.00000000000000006e63 or 1.40000000000000002e51 < x

    1. Initial program 86.6%

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

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

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

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

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

    if -1.00000000000000006e63 < x < 1.40000000000000002e51

    1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + \color{blue}{\frac{z - x}{\frac{t}{y}}} \]
    9. Taylor expanded in z around inf 87.0%

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

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

Alternative 5: 86.2% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+66} \lor \neg \left(x \leq 2.8 \cdot 10^{+50}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.4e66 or 2.7999999999999998e50 < x

    1. Initial program 86.6%

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

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

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

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

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

    if -1.4e66 < x < 2.7999999999999998e50

    1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 84.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{+60} \lor \neg \left(x \leq 1.15 \cdot 10^{+51}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.60000000000000034e60 or 1.15000000000000003e51 < x

    1. Initial program 86.6%

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

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

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

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

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

    if -4.60000000000000034e60 < x < 1.15000000000000003e51

    1. Initial program 93.9%

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

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

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

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

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

Alternative 7: 75.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{+154} \lor \neg \left(z \leq 5.7 \cdot 10^{+84}\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 (<= z -5.4e+154) (not (<= z 5.7e+84)))
   (* (- z x) (/ y t))
   (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -5.4e+154) || !(z <= 5.7e+84)) {
		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 ((z <= (-5.4d+154)) .or. (.not. (z <= 5.7d+84))) 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 ((z <= -5.4e+154) || !(z <= 5.7e+84)) {
		tmp = (z - x) * (y / t);
	} else {
		tmp = x * (1.0 - (y / t));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -5.4e+154) or not (z <= 5.7e+84):
		tmp = (z - x) * (y / t)
	else:
		tmp = x * (1.0 - (y / t))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((z <= -5.4e+154) || !(z <= 5.7e+84))
		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 ((z <= -5.4e+154) || ~((z <= 5.7e+84)))
		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[z, -5.4e+154], N[Not[LessEqual[z, 5.7e+84]], $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}\;z \leq -5.4 \cdot 10^{+154} \lor \neg \left(z \leq 5.7 \cdot 10^{+84}\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 z < -5.40000000000000011e154 or 5.6999999999999997e84 < z

    1. Initial program 86.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.40000000000000011e154 < z < 5.6999999999999997e84

    1. Initial program 92.8%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{+154} \lor \neg \left(z \leq 5.7 \cdot 10^{+84}\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 8: 71.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+144} \lor \neg \left(z \leq 4.2 \cdot 10^{+203}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.40000000000000003e144 or 4.19999999999999967e203 < z

    1. Initial program 85.4%

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

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

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

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

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

    if -1.40000000000000003e144 < z < 4.19999999999999967e203

    1. Initial program 92.2%

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

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

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

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

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

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

Alternative 9: 54.6% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+58} \lor \neg \left(y \leq 2.25 \cdot 10^{-20}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.60000000000000008e58 or 2.2500000000000001e-20 < y

    1. Initial program 83.0%

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

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

      \[\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. Simplified53.3%

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

    if -1.60000000000000008e58 < y < 2.2500000000000001e-20

    1. Initial program 98.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.6 \cdot 10^{+58} \lor \neg \left(y \leq 2.25 \cdot 10^{-20}\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.6%

    \[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. *-commutative85.9%

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

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

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

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

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

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

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

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

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

Alternative 11: 38.4% accurate, 9.0× speedup?

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

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

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

    \[\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 2024180 
(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)))