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

Percentage Accurate: 92.5% → 97.6%
Time: 17.6s
Alternatives: 13
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 13 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.5% 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.6% 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 87.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 54.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \frac{y}{t}\\ t_2 := x \cdot \frac{y}{-t}\\ \mathbf{if}\;y \leq -2.6 \cdot 10^{+162}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -2.45 \cdot 10^{-70}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{-116}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 10^{-79}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq 1.08 \cdot 10^{+18}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.22 \cdot 10^{+219}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (/ y t))) (t_2 (* x (/ y (- t)))))
   (if (<= y -2.6e+162)
     t_2
     (if (<= y -2.45e-70)
       t_1
       (if (<= y 1.02e-116)
         x
         (if (<= y 1e-79)
           t_2
           (if (<= y 1.08e+18) x (if (<= y 1.22e+219) t_1 t_2))))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (y / t);
	double t_2 = x * (y / -t);
	double tmp;
	if (y <= -2.6e+162) {
		tmp = t_2;
	} else if (y <= -2.45e-70) {
		tmp = t_1;
	} else if (y <= 1.02e-116) {
		tmp = x;
	} else if (y <= 1e-79) {
		tmp = t_2;
	} else if (y <= 1.08e+18) {
		tmp = x;
	} else if (y <= 1.22e+219) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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) :: t_2
    real(8) :: tmp
    t_1 = z * (y / t)
    t_2 = x * (y / -t)
    if (y <= (-2.6d+162)) then
        tmp = t_2
    else if (y <= (-2.45d-70)) then
        tmp = t_1
    else if (y <= 1.02d-116) then
        tmp = x
    else if (y <= 1d-79) then
        tmp = t_2
    else if (y <= 1.08d+18) then
        tmp = x
    else if (y <= 1.22d+219) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = z * (y / t);
	double t_2 = x * (y / -t);
	double tmp;
	if (y <= -2.6e+162) {
		tmp = t_2;
	} else if (y <= -2.45e-70) {
		tmp = t_1;
	} else if (y <= 1.02e-116) {
		tmp = x;
	} else if (y <= 1e-79) {
		tmp = t_2;
	} else if (y <= 1.08e+18) {
		tmp = x;
	} else if (y <= 1.22e+219) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (y / t)
	t_2 = x * (y / -t)
	tmp = 0
	if y <= -2.6e+162:
		tmp = t_2
	elif y <= -2.45e-70:
		tmp = t_1
	elif y <= 1.02e-116:
		tmp = x
	elif y <= 1e-79:
		tmp = t_2
	elif y <= 1.08e+18:
		tmp = x
	elif y <= 1.22e+219:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(y / t))
	t_2 = Float64(x * Float64(y / Float64(-t)))
	tmp = 0.0
	if (y <= -2.6e+162)
		tmp = t_2;
	elseif (y <= -2.45e-70)
		tmp = t_1;
	elseif (y <= 1.02e-116)
		tmp = x;
	elseif (y <= 1e-79)
		tmp = t_2;
	elseif (y <= 1.08e+18)
		tmp = x;
	elseif (y <= 1.22e+219)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * (y / t);
	t_2 = x * (y / -t);
	tmp = 0.0;
	if (y <= -2.6e+162)
		tmp = t_2;
	elseif (y <= -2.45e-70)
		tmp = t_1;
	elseif (y <= 1.02e-116)
		tmp = x;
	elseif (y <= 1e-79)
		tmp = t_2;
	elseif (y <= 1.08e+18)
		tmp = x;
	elseif (y <= 1.22e+219)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.6e+162], t$95$2, If[LessEqual[y, -2.45e-70], t$95$1, If[LessEqual[y, 1.02e-116], x, If[LessEqual[y, 1e-79], t$95$2, If[LessEqual[y, 1.08e+18], x, If[LessEqual[y, 1.22e+219], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
t_2 := x \cdot \frac{y}{-t}\\
\mathbf{if}\;y \leq -2.6 \cdot 10^{+162}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq -2.45 \cdot 10^{-70}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 1.02 \cdot 10^{-116}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 10^{-79}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq 1.08 \cdot 10^{+18}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 1.22 \cdot 10^{+219}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.6e162 or 1.02e-116 < y < 1e-79 or 1.22000000000000004e219 < y

    1. Initial program 89.8%

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{y}{t}} \]
      3. distribute-rgt-neg-in70.3%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{-1 \cdot y}{t}} \]
      6. mul-1-neg70.3%

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

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

    if -2.6e162 < y < -2.45e-70 or 1.08e18 < y < 1.22000000000000004e219

    1. Initial program 83.7%

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

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

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

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

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

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

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

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

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

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

    if -2.45e-70 < y < 1.02e-116 or 1e-79 < y < 1.08e18

    1. Initial program 97.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{+162}:\\ \;\;\;\;x \cdot \frac{y}{-t}\\ \mathbf{elif}\;y \leq -2.45 \cdot 10^{-70}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{-116}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 10^{-79}:\\ \;\;\;\;x \cdot \frac{y}{-t}\\ \mathbf{elif}\;y \leq 1.08 \cdot 10^{+18}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.22 \cdot 10^{+219}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{-t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 54.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \frac{y}{t}\\ t_2 := x \cdot \frac{y}{-t}\\ \mathbf{if}\;y \leq -9.2 \cdot 10^{+160}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -9.5 \cdot 10^{-71}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-112}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 5.3 \cdot 10^{-79}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq 2.15 \cdot 10^{+18}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{+219}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{t}{-y}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (/ y t))) (t_2 (* x (/ y (- t)))))
   (if (<= y -9.2e+160)
     t_2
     (if (<= y -9.5e-71)
       t_1
       (if (<= y 2.3e-112)
         x
         (if (<= y 5.3e-79)
           t_2
           (if (<= y 2.15e+18)
             x
             (if (<= y 3.4e+219) t_1 (/ x (/ t (- y)))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (y / t);
	double t_2 = x * (y / -t);
	double tmp;
	if (y <= -9.2e+160) {
		tmp = t_2;
	} else if (y <= -9.5e-71) {
		tmp = t_1;
	} else if (y <= 2.3e-112) {
		tmp = x;
	} else if (y <= 5.3e-79) {
		tmp = t_2;
	} else if (y <= 2.15e+18) {
		tmp = x;
	} else if (y <= 3.4e+219) {
		tmp = t_1;
	} else {
		tmp = x / (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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = z * (y / t)
    t_2 = x * (y / -t)
    if (y <= (-9.2d+160)) then
        tmp = t_2
    else if (y <= (-9.5d-71)) then
        tmp = t_1
    else if (y <= 2.3d-112) then
        tmp = x
    else if (y <= 5.3d-79) then
        tmp = t_2
    else if (y <= 2.15d+18) then
        tmp = x
    else if (y <= 3.4d+219) then
        tmp = t_1
    else
        tmp = x / (t / -y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = z * (y / t);
	double t_2 = x * (y / -t);
	double tmp;
	if (y <= -9.2e+160) {
		tmp = t_2;
	} else if (y <= -9.5e-71) {
		tmp = t_1;
	} else if (y <= 2.3e-112) {
		tmp = x;
	} else if (y <= 5.3e-79) {
		tmp = t_2;
	} else if (y <= 2.15e+18) {
		tmp = x;
	} else if (y <= 3.4e+219) {
		tmp = t_1;
	} else {
		tmp = x / (t / -y);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (y / t)
	t_2 = x * (y / -t)
	tmp = 0
	if y <= -9.2e+160:
		tmp = t_2
	elif y <= -9.5e-71:
		tmp = t_1
	elif y <= 2.3e-112:
		tmp = x
	elif y <= 5.3e-79:
		tmp = t_2
	elif y <= 2.15e+18:
		tmp = x
	elif y <= 3.4e+219:
		tmp = t_1
	else:
		tmp = x / (t / -y)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(y / t))
	t_2 = Float64(x * Float64(y / Float64(-t)))
	tmp = 0.0
	if (y <= -9.2e+160)
		tmp = t_2;
	elseif (y <= -9.5e-71)
		tmp = t_1;
	elseif (y <= 2.3e-112)
		tmp = x;
	elseif (y <= 5.3e-79)
		tmp = t_2;
	elseif (y <= 2.15e+18)
		tmp = x;
	elseif (y <= 3.4e+219)
		tmp = t_1;
	else
		tmp = Float64(x / Float64(t / Float64(-y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * (y / t);
	t_2 = x * (y / -t);
	tmp = 0.0;
	if (y <= -9.2e+160)
		tmp = t_2;
	elseif (y <= -9.5e-71)
		tmp = t_1;
	elseif (y <= 2.3e-112)
		tmp = x;
	elseif (y <= 5.3e-79)
		tmp = t_2;
	elseif (y <= 2.15e+18)
		tmp = x;
	elseif (y <= 3.4e+219)
		tmp = t_1;
	else
		tmp = x / (t / -y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.2e+160], t$95$2, If[LessEqual[y, -9.5e-71], t$95$1, If[LessEqual[y, 2.3e-112], x, If[LessEqual[y, 5.3e-79], t$95$2, If[LessEqual[y, 2.15e+18], x, If[LessEqual[y, 3.4e+219], t$95$1, N[(x / N[(t / (-y)), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
t_2 := x \cdot \frac{y}{-t}\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{+160}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq -9.5 \cdot 10^{-71}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 2.3 \cdot 10^{-112}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 5.3 \cdot 10^{-79}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq 2.15 \cdot 10^{+18}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 3.4 \cdot 10^{+219}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -9.1999999999999995e160 or 2.29999999999999991e-112 < y < 5.2999999999999998e-79

    1. Initial program 92.9%

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{y}{t}} \]
      3. distribute-rgt-neg-in68.2%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{-1 \cdot y}{t}} \]
      6. mul-1-neg68.2%

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

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

    if -9.1999999999999995e160 < y < -9.4999999999999994e-71 or 2.15e18 < y < 3.40000000000000016e219

    1. Initial program 83.7%

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

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

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

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

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

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

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

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

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

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

    if -9.4999999999999994e-71 < y < 2.29999999999999991e-112 or 5.2999999999999998e-79 < y < 2.15e18

    1. Initial program 97.9%

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

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

    if 3.40000000000000016e219 < y

    1. Initial program 84.7%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{-1 \cdot y}{t}} \]
      6. mul-1-neg73.6%

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

      \[\leadsto \color{blue}{x \cdot \frac{-y}{t}} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt0.0%

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

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

        \[\leadsto x \cdot \frac{\sqrt{\color{blue}{y \cdot y}}}{t} \]
      4. sqrt-unprod1.1%

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

        \[\leadsto x \cdot \frac{\color{blue}{y}}{t} \]
      6. clear-num1.1%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{t}{y}}} \]
      7. div-inv1.1%

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

        \[\leadsto \color{blue}{\frac{-x}{-\frac{t}{y}}} \]
      9. distribute-frac-neg21.1%

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

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

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

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

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

        \[\leadsto \frac{-x}{\frac{t}{\color{blue}{y}}} \]
    8. Applied egg-rr73.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.2 \cdot 10^{+160}:\\ \;\;\;\;x \cdot \frac{y}{-t}\\ \mathbf{elif}\;y \leq -9.5 \cdot 10^{-71}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-112}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 5.3 \cdot 10^{-79}:\\ \;\;\;\;x \cdot \frac{y}{-t}\\ \mathbf{elif}\;y \leq 2.15 \cdot 10^{+18}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{+219}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{t}{-y}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 82.5% accurate, 0.4× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.0999999999999998e48 or 3.9e63 < x

    1. Initial program 85.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)} \]

    if -2.0999999999999998e48 < x < 1.59999999999999993e-161

    1. Initial program 93.9%

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

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

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

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

    if 1.59999999999999993e-161 < x < 3.9e63

    1. Initial program 97.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 82.0% accurate, 0.4× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -8.4999999999999996e46 or 5.5000000000000004e55 < x

    1. Initial program 85.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)} \]

    if -8.4999999999999996e46 < x < 5.1999999999999999e-162

    1. Initial program 93.9%

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

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

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

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

    if 5.1999999999999999e-162 < x < 5.5000000000000004e55

    1. Initial program 97.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.5 \cdot 10^{+46}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{-162}:\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{+55}:\\ \;\;\;\;\frac{\left(z - x\right) \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 82.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{if}\;x \leq -9 \cdot 10^{+49}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{-162}:\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \mathbf{elif}\;x \leq 1.86 \cdot 10^{+59}:\\ \;\;\;\;\frac{z - x}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- 1.0 (/ y t)))))
   (if (<= x -9e+49)
     t_1
     (if (<= x 3.3e-162)
       (+ x (* y (/ z t)))
       (if (<= x 1.86e+59) (/ (- z x) (/ t y)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - (y / t));
	double tmp;
	if (x <= -9e+49) {
		tmp = t_1;
	} else if (x <= 3.3e-162) {
		tmp = x + (y * (z / t));
	} else if (x <= 1.86e+59) {
		tmp = (z - x) / (t / y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * (1.0d0 - (y / t))
    if (x <= (-9d+49)) then
        tmp = t_1
    else if (x <= 3.3d-162) then
        tmp = x + (y * (z / t))
    else if (x <= 1.86d+59) then
        tmp = (z - x) / (t / y)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - (y / t));
	double tmp;
	if (x <= -9e+49) {
		tmp = t_1;
	} else if (x <= 3.3e-162) {
		tmp = x + (y * (z / t));
	} else if (x <= 1.86e+59) {
		tmp = (z - x) / (t / y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (1.0 - (y / t))
	tmp = 0
	if x <= -9e+49:
		tmp = t_1
	elif x <= 3.3e-162:
		tmp = x + (y * (z / t))
	elif x <= 1.86e+59:
		tmp = (z - x) / (t / y)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(1.0 - Float64(y / t)))
	tmp = 0.0
	if (x <= -9e+49)
		tmp = t_1;
	elseif (x <= 3.3e-162)
		tmp = Float64(x + Float64(y * Float64(z / t)));
	elseif (x <= 1.86e+59)
		tmp = Float64(Float64(z - x) / Float64(t / y));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (1.0 - (y / t));
	tmp = 0.0;
	if (x <= -9e+49)
		tmp = t_1;
	elseif (x <= 3.3e-162)
		tmp = x + (y * (z / t));
	elseif (x <= 1.86e+59)
		tmp = (z - x) / (t / y);
	else
		tmp = t_1;
	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, -9e+49], t$95$1, If[LessEqual[x, 3.3e-162], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.86e+59], N[(N[(z - x), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -8.99999999999999965e49 or 1.85999999999999995e59 < x

    1. Initial program 85.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)} \]

    if -8.99999999999999965e49 < x < 3.30000000000000013e-162

    1. Initial program 93.9%

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

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

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

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

    if 3.30000000000000013e-162 < x < 1.85999999999999995e59

    1. Initial program 97.6%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{z - x}{\frac{t}{y}}} \]
    7. Applied egg-rr88.9%

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

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

Alternative 7: 76.3% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.80000000000000028e-8 or 4.9000000000000003e60 < x

    1. Initial program 85.0%

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

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

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

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

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

    if -3.80000000000000028e-8 < x < 4.9000000000000003e60

    1. Initial program 96.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 75.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-9} \lor \neg \left(x \leq 2.45 \cdot 10^{+55}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.5000000000000003e-9 or 2.45000000000000007e55 < x

    1. Initial program 85.0%

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

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

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

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

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

    if -6.5000000000000003e-9 < x < 2.45000000000000007e55

    1. Initial program 96.1%

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

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

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

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

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

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

Alternative 9: 72.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+154}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+130}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -4.3e+154)
   (* y (/ z t))
   (if (<= z 6e+130) (* x (- 1.0 (/ y t))) (* z (/ y t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -4.3e+154) {
		tmp = y * (z / t);
	} else if (z <= 6e+130) {
		tmp = x * (1.0 - (y / t));
	} else {
		tmp = z * (y / t);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (z <= (-4.3d+154)) then
        tmp = y * (z / t)
    else if (z <= 6d+130) then
        tmp = x * (1.0d0 - (y / t))
    else
        tmp = z * (y / t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -4.3e+154) {
		tmp = y * (z / t);
	} else if (z <= 6e+130) {
		tmp = x * (1.0 - (y / t));
	} else {
		tmp = z * (y / t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -4.3e+154:
		tmp = y * (z / t)
	elif z <= 6e+130:
		tmp = x * (1.0 - (y / t))
	else:
		tmp = z * (y / t)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -4.3e+154)
		tmp = Float64(y * Float64(z / t));
	elseif (z <= 6e+130)
		tmp = Float64(x * Float64(1.0 - Float64(y / t)));
	else
		tmp = Float64(z * Float64(y / t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -4.3e+154)
		tmp = y * (z / t);
	elseif (z <= 6e+130)
		tmp = x * (1.0 - (y / t));
	else
		tmp = z * (y / t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.3e+154], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e+130], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 85.4%

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

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

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

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

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

    if -4.2999999999999998e154 < z < 5.9999999999999999e130

    1. Initial program 92.1%

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

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

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

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

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

    if 5.9999999999999999e130 < z

    1. Initial program 87.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 54.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{-70} \lor \neg \left(y \leq 2 \cdot 10^{+21}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.15e-70 or 2e21 < y

    1. Initial program 85.5%

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

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

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

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

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

    if -2.15e-70 < y < 2e21

    1. Initial program 98.1%

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

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

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

Alternative 11: 55.4% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.69999999999999998e-70 or 1e19 < y

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

    if -1.69999999999999998e-70 < y < 1e19

    1. Initial program 98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 38.9% accurate, 9.0× speedup?

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

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

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

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

    \[\leadsto x \]
  5. Add Preprocessing

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

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

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