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

Percentage Accurate: 92.9% → 97.6%
Time: 8.9s
Alternatives: 11
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 92.9% 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{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 91.0%

    \[x + \frac{y \cdot \left(z - x\right)}{t} \]
  2. Add Preprocessing
  3. Taylor expanded in z around 0 89.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. +-commutative89.1%

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

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

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

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

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

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

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

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

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

Alternative 2: 51.1% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;y \leq 2.4 \cdot 10^{-20}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.3999999999999999e-50

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

    if -1.3999999999999999e-50 < y < 2.39999999999999993e-20

    1. Initial program 97.5%

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

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

    if 2.39999999999999993e-20 < y < 2.3000000000000002e87

    1. Initial program 93.5%

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

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

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

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

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

    if 2.3000000000000002e87 < y

    1. Initial program 79.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-x \cdot \frac{y}{t}} \]
      3. add-sqr-sqrt64.8%

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

        \[\leadsto -x \cdot \frac{\color{blue}{\sqrt{y \cdot y}}}{t} \]
      5. sqr-neg52.7%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{-50}:\\ \;\;\;\;x \cdot \frac{y}{-t}\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-20}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+87}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{-t}{y}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 51.2% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x}{\frac{-t}{y}}\\
\mathbf{if}\;y \leq -1.6 \cdot 10^{-50}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 9.8 \cdot 10^{-23}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.6e-50 or 3.64999999999999997e90 < y

    1. Initial program 82.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-x \cdot \frac{y}{t}} \]
      3. add-sqr-sqrt19.8%

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

        \[\leadsto -x \cdot \frac{\color{blue}{\sqrt{y \cdot y}}}{t} \]
      5. sqr-neg17.9%

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

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

        \[\leadsto -x \cdot \frac{\color{blue}{-y}}{t} \]
      8. clear-num2.4%

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\frac{t}{-y}}} \]
      9. un-div-inv2.4%

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

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

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

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

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

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

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

    if -1.6e-50 < y < 9.7999999999999996e-23

    1. Initial program 97.5%

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

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

    if 9.7999999999999996e-23 < y < 3.64999999999999997e90

    1. Initial program 93.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.6 \cdot 10^{-50}:\\ \;\;\;\;\frac{x}{\frac{-t}{y}}\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{-23}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 3.65 \cdot 10^{+90}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{-t}{y}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 84.5% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.24999999999999988e94 or 2.7999999999999998 < z

    1. Initial program 86.9%

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

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

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

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

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

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

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

        \[\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. Taylor expanded in z around inf 94.6%

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

    if -3.24999999999999988e94 < z < 2.7999999999999998

    1. Initial program 93.8%

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

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

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

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

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

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

Alternative 5: 74.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+93} \lor \neg \left(z \leq 1.6 \cdot 10^{+125}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.9000000000000002e93 or 1.59999999999999992e125 < z

    1. Initial program 85.6%

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

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

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

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

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

    if -3.9000000000000002e93 < z < 1.59999999999999992e125

    1. Initial program 93.5%

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

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

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

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

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

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

Alternative 6: 84.9% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 89.0%

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

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

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

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

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

    if -4.49999999999999998e55 < x < 1.9000000000000001e-14

    1. Initial program 91.4%

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

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

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

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

    if 1.9000000000000001e-14 < x

    1. Initial program 92.5%

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

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

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

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

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

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

Alternative 7: 72.7% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 89.4%

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

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

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

    if -1.15000000000000008e96 < z < 2.1000000000000001e125

    1. Initial program 93.5%

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

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

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

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

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

    if 2.1000000000000001e125 < z

    1. Initial program 80.2%

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

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

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

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

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

Alternative 8: 52.9% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.3e112 or 1.59999999999999985e-20 < y

    1. Initial program 84.3%

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

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

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

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

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

    if -1.3e112 < y < 1.59999999999999985e-20

    1. Initial program 96.0%

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

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

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

Alternative 9: 52.2% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t \leq 6.2 \cdot 10^{-181}:\\
\;\;\;\;\frac{y \cdot z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.2e20 or 6.20000000000000043e-181 < t

    1. Initial program 86.6%

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

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

    if -2.2e20 < t < 6.20000000000000043e-181

    1. Initial program 97.7%

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

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

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

Alternative 10: 52.9% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;y \leq 2.25 \cdot 10^{-22}:\\
\;\;\;\;x\\

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


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

    1. Initial program 81.8%

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

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

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

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

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

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

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

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

    if -1.24999999999999995e110 < y < 2.24999999999999993e-22

    1. Initial program 96.0%

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

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

    if 2.24999999999999993e-22 < y

    1. Initial program 86.2%

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

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

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

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

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

Alternative 11: 38.7% 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 91.0%

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

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

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

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

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