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

Percentage Accurate: 92.8% → 97.5%
Time: 7.7s
Alternatives: 12
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 12 alternatives:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 48.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.15 \cdot 10^{+153}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.52 \cdot 10^{+106}:\\ \;\;\;\;x \cdot \frac{y}{-t}\\ \mathbf{elif}\;t \leq -0.085:\\ \;\;\;\;\frac{y}{\frac{t}{z}}\\ \mathbf{elif}\;t \leq 5.1 \cdot 10^{-85}:\\ \;\;\;\;\frac{x}{\frac{-t}{y}}\\ \mathbf{elif}\;t \leq 1.2 \cdot 10^{+102}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -1.15e+153)
   x
   (if (<= t -1.52e+106)
     (* x (/ y (- t)))
     (if (<= t -0.085)
       (/ y (/ t z))
       (if (<= t 5.1e-85)
         (/ x (/ (- t) y))
         (if (<= t 1.2e+102) (* y (/ z t)) x))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.15e+153) {
		tmp = x;
	} else if (t <= -1.52e+106) {
		tmp = x * (y / -t);
	} else if (t <= -0.085) {
		tmp = y / (t / z);
	} else if (t <= 5.1e-85) {
		tmp = x / (-t / y);
	} else if (t <= 1.2e+102) {
		tmp = y * (z / t);
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-1.15d+153)) then
        tmp = x
    else if (t <= (-1.52d+106)) then
        tmp = x * (y / -t)
    else if (t <= (-0.085d0)) then
        tmp = y / (t / z)
    else if (t <= 5.1d-85) then
        tmp = x / (-t / y)
    else if (t <= 1.2d+102) then
        tmp = y * (z / t)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.15e+153) {
		tmp = x;
	} else if (t <= -1.52e+106) {
		tmp = x * (y / -t);
	} else if (t <= -0.085) {
		tmp = y / (t / z);
	} else if (t <= 5.1e-85) {
		tmp = x / (-t / y);
	} else if (t <= 1.2e+102) {
		tmp = y * (z / t);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -1.15e+153:
		tmp = x
	elif t <= -1.52e+106:
		tmp = x * (y / -t)
	elif t <= -0.085:
		tmp = y / (t / z)
	elif t <= 5.1e-85:
		tmp = x / (-t / y)
	elif t <= 1.2e+102:
		tmp = y * (z / t)
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -1.15e+153)
		tmp = x;
	elseif (t <= -1.52e+106)
		tmp = Float64(x * Float64(y / Float64(-t)));
	elseif (t <= -0.085)
		tmp = Float64(y / Float64(t / z));
	elseif (t <= 5.1e-85)
		tmp = Float64(x / Float64(Float64(-t) / y));
	elseif (t <= 1.2e+102)
		tmp = Float64(y * Float64(z / t));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -1.15e+153)
		tmp = x;
	elseif (t <= -1.52e+106)
		tmp = x * (y / -t);
	elseif (t <= -0.085)
		tmp = y / (t / z);
	elseif (t <= 5.1e-85)
		tmp = x / (-t / y);
	elseif (t <= 1.2e+102)
		tmp = y * (z / t);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.15e+153], x, If[LessEqual[t, -1.52e+106], N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -0.085], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.1e-85], N[(x / N[((-t) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.2e+102], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -1.52 \cdot 10^{+106}:\\
\;\;\;\;x \cdot \frac{y}{-t}\\

\mathbf{elif}\;t \leq -0.085:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if t < -1.1500000000000001e153 or 1.19999999999999997e102 < t

    1. Initial program 74.2%

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

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

    if -1.1500000000000001e153 < t < -1.52e106

    1. Initial program 85.4%

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

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

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

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

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

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

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

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

    if -1.52e106 < t < -0.0850000000000000061

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if -0.0850000000000000061 < t < 5.1000000000000002e-85

    1. Initial program 98.8%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{-x}{t}} \]
    7. Step-by-step derivation
      1. *-commutative53.8%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{t}{y}}} \]
      10. div-inv5.6%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-\frac{t}{y}} \]
      16. add-sqr-sqrt59.2%

        \[\leadsto \frac{\color{blue}{x}}{-\frac{t}{y}} \]
      17. distribute-neg-frac259.2%

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

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

    if 5.1000000000000002e-85 < t < 1.19999999999999997e102

    1. Initial program 97.5%

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

      \[\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*87.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.15 \cdot 10^{+153}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.52 \cdot 10^{+106}:\\ \;\;\;\;x \cdot \frac{y}{-t}\\ \mathbf{elif}\;t \leq -0.085:\\ \;\;\;\;\frac{y}{\frac{t}{z}}\\ \mathbf{elif}\;t \leq 5.1 \cdot 10^{-85}:\\ \;\;\;\;\frac{x}{\frac{-t}{y}}\\ \mathbf{elif}\;t \leq 1.2 \cdot 10^{+102}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 48.8% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;t \leq -0.029:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\

\mathbf{elif}\;t \leq 6.2 \cdot 10^{-80}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -1.1500000000000001e153 or 8.5999999999999999e106 < t

    1. Initial program 74.2%

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

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

    if -1.1500000000000001e153 < t < -7.9999999999999995e105 or -0.0290000000000000015 < t < 6.20000000000000032e-80

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

    if -7.9999999999999995e105 < t < -0.0290000000000000015

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if 6.20000000000000032e-80 < t < 8.5999999999999999e106

    1. Initial program 97.5%

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

      \[\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*87.4%

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

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

Alternative 4: 83.6% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;t \leq -5.6 \cdot 10^{-10} \lor \neg \left(t \leq 2.4 \cdot 10^{-27}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -8.59999999999999995e189

    1. Initial program 68.7%

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

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

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

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

    if -8.59999999999999995e189 < t < -3.25000000000000024e105

    1. Initial program 81.2%

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

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

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

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

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

    if -3.25000000000000024e105 < t < -5.60000000000000031e-10 or 2.40000000000000002e-27 < t

    1. Initial program 88.3%

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

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

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

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

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

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

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

    if -5.60000000000000031e-10 < t < 2.40000000000000002e-27

    1. Initial program 98.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -8.6 \cdot 10^{+189}:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \mathbf{elif}\;t \leq -3.25 \cdot 10^{+105}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{elif}\;t \leq -5.6 \cdot 10^{-10} \lor \neg \left(t \leq 2.4 \cdot 10^{-27}\right):\\ \;\;\;\;x + \frac{y}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(z - x\right)}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 82.6% accurate, 0.3× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -7.99999999999999982e195

    1. Initial program 68.7%

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

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

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

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

    if -7.99999999999999982e195 < t < -1.16000000000000004e106

    1. Initial program 81.2%

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

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

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

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

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

    if -1.16000000000000004e106 < t < -3.9e-10 or 6.00000000000000057e-20 < t

    1. Initial program 88.3%

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

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

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

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

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

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

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

    if -3.9e-10 < t < 6.00000000000000057e-20

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -8 \cdot 10^{+195}:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \mathbf{elif}\;t \leq -1.16 \cdot 10^{+106}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{elif}\;t \leq -3.9 \cdot 10^{-10} \lor \neg \left(t \leq 6 \cdot 10^{-20}\right):\\ \;\;\;\;x + \frac{y}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 82.9% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;t \leq -3 \cdot 10^{-9} \lor \neg \left(t \leq 2.3 \cdot 10^{-26}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.49999999999999996e189 or -1.39999999999999996e106 < t < -2.99999999999999998e-9 or 2.30000000000000009e-26 < t

    1. Initial program 84.1%

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

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

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

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

    if -3.49999999999999996e189 < t < -1.39999999999999996e106

    1. Initial program 81.2%

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

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

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

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

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

    if -2.99999999999999998e-9 < t < 2.30000000000000009e-26

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.5 \cdot 10^{+189}:\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \mathbf{elif}\;t \leq -1.4 \cdot 10^{+106}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{elif}\;t \leq -3 \cdot 10^{-9} \lor \neg \left(t \leq 2.3 \cdot 10^{-26}\right):\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 73.0% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;x \leq -4.3 \cdot 10^{-151}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\

\mathbf{elif}\;x \leq -7 \cdot 10^{-177} \lor \neg \left(x \leq 2.55 \cdot 10^{-59}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.94999999999999987e-33 or -4.30000000000000018e-151 < x < -7.0000000000000003e-177 or 2.5499999999999998e-59 < x

    1. Initial program 89.0%

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

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

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

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

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

    if -1.94999999999999987e-33 < x < -4.30000000000000018e-151

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

    if -7.0000000000000003e-177 < x < 2.5499999999999998e-59

    1. Initial program 91.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{-33}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{elif}\;x \leq -4.3 \cdot 10^{-151}:\\ \;\;\;\;\frac{y}{\frac{t}{z}}\\ \mathbf{elif}\;x \leq -7 \cdot 10^{-177} \lor \neg \left(x \leq 2.55 \cdot 10^{-59}\right):\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 82.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \frac{y}{t} \cdot z\\ \mathbf{if}\;t \leq -4.2 \cdot 10^{+188}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq -7.4 \cdot 10^{+105}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{elif}\;t \leq -3.8 \cdot 10^{-6}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 1.3 \cdot 10^{-25}:\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (* (/ y t) z))))
   (if (<= t -4.2e+188)
     t_1
     (if (<= t -7.4e+105)
       (* x (- 1.0 (/ y t)))
       (if (<= t -3.8e-6)
         t_1
         (if (<= t 1.3e-25) (* (/ y t) (- z x)) (+ x (* y (/ z t)))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x + ((y / t) * z);
	double tmp;
	if (t <= -4.2e+188) {
		tmp = t_1;
	} else if (t <= -7.4e+105) {
		tmp = x * (1.0 - (y / t));
	} else if (t <= -3.8e-6) {
		tmp = t_1;
	} else if (t <= 1.3e-25) {
		tmp = (y / t) * (z - x);
	} 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) :: t_1
    real(8) :: tmp
    t_1 = x + ((y / t) * z)
    if (t <= (-4.2d+188)) then
        tmp = t_1
    else if (t <= (-7.4d+105)) then
        tmp = x * (1.0d0 - (y / t))
    else if (t <= (-3.8d-6)) then
        tmp = t_1
    else if (t <= 1.3d-25) then
        tmp = (y / t) * (z - x)
    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 t_1 = x + ((y / t) * z);
	double tmp;
	if (t <= -4.2e+188) {
		tmp = t_1;
	} else if (t <= -7.4e+105) {
		tmp = x * (1.0 - (y / t));
	} else if (t <= -3.8e-6) {
		tmp = t_1;
	} else if (t <= 1.3e-25) {
		tmp = (y / t) * (z - x);
	} else {
		tmp = x + (y * (z / t));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + ((y / t) * z)
	tmp = 0
	if t <= -4.2e+188:
		tmp = t_1
	elif t <= -7.4e+105:
		tmp = x * (1.0 - (y / t))
	elif t <= -3.8e-6:
		tmp = t_1
	elif t <= 1.3e-25:
		tmp = (y / t) * (z - x)
	else:
		tmp = x + (y * (z / t))
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(Float64(y / t) * z))
	tmp = 0.0
	if (t <= -4.2e+188)
		tmp = t_1;
	elseif (t <= -7.4e+105)
		tmp = Float64(x * Float64(1.0 - Float64(y / t)));
	elseif (t <= -3.8e-6)
		tmp = t_1;
	elseif (t <= 1.3e-25)
		tmp = Float64(Float64(y / t) * Float64(z - x));
	else
		tmp = Float64(x + Float64(y * Float64(z / t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + ((y / t) * z);
	tmp = 0.0;
	if (t <= -4.2e+188)
		tmp = t_1;
	elseif (t <= -7.4e+105)
		tmp = x * (1.0 - (y / t));
	elseif (t <= -3.8e-6)
		tmp = t_1;
	elseif (t <= 1.3e-25)
		tmp = (y / t) * (z - x);
	else
		tmp = x + (y * (z / t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.2e+188], t$95$1, If[LessEqual[t, -7.4e+105], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3.8e-6], t$95$1, If[LessEqual[t, 1.3e-25], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;t \leq -3.8 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -4.19999999999999973e188 or -7.3999999999999997e105 < t < -3.8e-6

    1. Initial program 82.7%

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

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

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

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

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

    if -4.19999999999999973e188 < t < -7.3999999999999997e105

    1. Initial program 81.2%

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

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

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

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

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

    if -3.8e-6 < t < 1.3e-25

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

    if 1.3e-25 < t

    1. Initial program 85.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.2 \cdot 10^{+188}:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \mathbf{elif}\;t \leq -7.4 \cdot 10^{+105}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{elif}\;t \leq -3.8 \cdot 10^{-6}:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \mathbf{elif}\;t \leq 1.3 \cdot 10^{-25}:\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 77.2% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-20} \lor \neg \left(x \leq 3.5 \cdot 10^{+14}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.9999999999999999e-20 or 3.5e14 < 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 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 -4.9999999999999999e-20 < x < 3.5e14

    1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 53.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-13} \lor \neg \left(z \leq 1.12 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{y}{t} \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.4499999999999999e-13 or 1.11999999999999994e-8 < z

    1. Initial program 86.4%

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

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

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

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

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

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

    if -1.4499999999999999e-13 < z < 1.11999999999999994e-8

    1. Initial program 94.0%

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

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

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

Alternative 11: 51.8% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.4000000000000001e-12 or 2.9000000000000002e-12 < z

    1. Initial program 86.4%

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

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

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

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

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

    if -1.4000000000000001e-12 < z < 2.9000000000000002e-12

    1. Initial program 94.0%

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

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

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

Alternative 12: 38.8% 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.2%

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

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

Developer target: 91.1% accurate, 0.6× speedup?

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

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

Reproduce

?
herbie shell --seed 2024081 
(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)))