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

Percentage Accurate: 92.3% → 98.1%
Time: 9.7s
Alternatives: 13
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 92.3% 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: 98.1% 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 94.7%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 53.0% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x \cdot \left(-y\right)}{t}\\ t_2 := y \cdot \frac{z}{t}\\ t_3 := \frac{y \cdot z}{t}\\ \mathbf{if}\;t \leq -5.9 \cdot 10^{+38}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -0.29:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq -6.1 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.04 \cdot 10^{-66}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq -9.6 \cdot 10^{-153}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq -2.25 \cdot 10^{-254}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t \leq 4.2 \cdot 10^{-232}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{+35}:\\ \;\;\;\;t\_3\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* x (- y)) t)) (t_2 (* y (/ z t))) (t_3 (/ (* y z) t)))
   (if (<= t -5.9e+38)
     x
     (if (<= t -0.29)
       t_2
       (if (<= t -6.1e-34)
         x
         (if (<= t -1.04e-66)
           t_2
           (if (<= t -9.6e-153)
             t_1
             (if (<= t -2.25e-254)
               t_3
               (if (<= t 4.2e-232) t_1 (if (<= t 9.5e+35) t_3 x))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x * -y) / t;
	double t_2 = y * (z / t);
	double t_3 = (y * z) / t;
	double tmp;
	if (t <= -5.9e+38) {
		tmp = x;
	} else if (t <= -0.29) {
		tmp = t_2;
	} else if (t <= -6.1e-34) {
		tmp = x;
	} else if (t <= -1.04e-66) {
		tmp = t_2;
	} else if (t <= -9.6e-153) {
		tmp = t_1;
	} else if (t <= -2.25e-254) {
		tmp = t_3;
	} else if (t <= 4.2e-232) {
		tmp = t_1;
	} else if (t <= 9.5e+35) {
		tmp = t_3;
	} 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) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = (x * -y) / t
    t_2 = y * (z / t)
    t_3 = (y * z) / t
    if (t <= (-5.9d+38)) then
        tmp = x
    else if (t <= (-0.29d0)) then
        tmp = t_2
    else if (t <= (-6.1d-34)) then
        tmp = x
    else if (t <= (-1.04d-66)) then
        tmp = t_2
    else if (t <= (-9.6d-153)) then
        tmp = t_1
    else if (t <= (-2.25d-254)) then
        tmp = t_3
    else if (t <= 4.2d-232) then
        tmp = t_1
    else if (t <= 9.5d+35) then
        tmp = t_3
    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 t_2 = y * (z / t);
	double t_3 = (y * z) / t;
	double tmp;
	if (t <= -5.9e+38) {
		tmp = x;
	} else if (t <= -0.29) {
		tmp = t_2;
	} else if (t <= -6.1e-34) {
		tmp = x;
	} else if (t <= -1.04e-66) {
		tmp = t_2;
	} else if (t <= -9.6e-153) {
		tmp = t_1;
	} else if (t <= -2.25e-254) {
		tmp = t_3;
	} else if (t <= 4.2e-232) {
		tmp = t_1;
	} else if (t <= 9.5e+35) {
		tmp = t_3;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x * -y) / t
	t_2 = y * (z / t)
	t_3 = (y * z) / t
	tmp = 0
	if t <= -5.9e+38:
		tmp = x
	elif t <= -0.29:
		tmp = t_2
	elif t <= -6.1e-34:
		tmp = x
	elif t <= -1.04e-66:
		tmp = t_2
	elif t <= -9.6e-153:
		tmp = t_1
	elif t <= -2.25e-254:
		tmp = t_3
	elif t <= 4.2e-232:
		tmp = t_1
	elif t <= 9.5e+35:
		tmp = t_3
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x * Float64(-y)) / t)
	t_2 = Float64(y * Float64(z / t))
	t_3 = Float64(Float64(y * z) / t)
	tmp = 0.0
	if (t <= -5.9e+38)
		tmp = x;
	elseif (t <= -0.29)
		tmp = t_2;
	elseif (t <= -6.1e-34)
		tmp = x;
	elseif (t <= -1.04e-66)
		tmp = t_2;
	elseif (t <= -9.6e-153)
		tmp = t_1;
	elseif (t <= -2.25e-254)
		tmp = t_3;
	elseif (t <= 4.2e-232)
		tmp = t_1;
	elseif (t <= 9.5e+35)
		tmp = t_3;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x * -y) / t;
	t_2 = y * (z / t);
	t_3 = (y * z) / t;
	tmp = 0.0;
	if (t <= -5.9e+38)
		tmp = x;
	elseif (t <= -0.29)
		tmp = t_2;
	elseif (t <= -6.1e-34)
		tmp = x;
	elseif (t <= -1.04e-66)
		tmp = t_2;
	elseif (t <= -9.6e-153)
		tmp = t_1;
	elseif (t <= -2.25e-254)
		tmp = t_3;
	elseif (t <= 4.2e-232)
		tmp = t_1;
	elseif (t <= 9.5e+35)
		tmp = t_3;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * (-y)), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -5.9e+38], x, If[LessEqual[t, -0.29], t$95$2, If[LessEqual[t, -6.1e-34], x, If[LessEqual[t, -1.04e-66], t$95$2, If[LessEqual[t, -9.6e-153], t$95$1, If[LessEqual[t, -2.25e-254], t$95$3, If[LessEqual[t, 4.2e-232], t$95$1, If[LessEqual[t, 9.5e+35], t$95$3, x]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(-y\right)}{t}\\
t_2 := y \cdot \frac{z}{t}\\
t_3 := \frac{y \cdot z}{t}\\
\mathbf{if}\;t \leq -5.9 \cdot 10^{+38}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq -0.29:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t \leq -6.1 \cdot 10^{-34}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq -1.04 \cdot 10^{-66}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t \leq -9.6 \cdot 10^{-153}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq -2.25 \cdot 10^{-254}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t \leq 4.2 \cdot 10^{-232}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 9.5 \cdot 10^{+35}:\\
\;\;\;\;t\_3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -5.89999999999999981e38 or -0.28999999999999998 < t < -6.0999999999999998e-34 or 9.50000000000000062e35 < t

    1. Initial program 89.6%

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

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

    if -5.89999999999999981e38 < t < -0.28999999999999998 or -6.0999999999999998e-34 < t < -1.04e-66

    1. Initial program 94.2%

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

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

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

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

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

    if -1.04e-66 < t < -9.6000000000000008e-153 or -2.25e-254 < t < 4.2000000000000001e-232

    1. Initial program 99.8%

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

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

        \[\leadsto x + \frac{\color{blue}{-x \cdot y}}{t} \]
      2. distribute-lft-neg-out75.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{t \cdot x - y \cdot x}}{t} \]
      5. *-commutative75.9%

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

      \[\leadsto \color{blue}{\frac{x \cdot t - y \cdot x}{t}} \]
    9. Taylor expanded in t around 0 70.8%

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

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

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

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

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

    if -9.6000000000000008e-153 < t < -2.25e-254 or 4.2000000000000001e-232 < t < 9.50000000000000062e35

    1. Initial program 98.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.9 \cdot 10^{+38}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -0.29:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{elif}\;t \leq -6.1 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.04 \cdot 10^{-66}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{elif}\;t \leq -9.6 \cdot 10^{-153}:\\ \;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\ \mathbf{elif}\;t \leq -2.25 \cdot 10^{-254}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{elif}\;t \leq 4.2 \cdot 10^{-232}:\\ \;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{+35}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 51.4% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t \leq -0.3 \lor \neg \left(t \leq -6.2 \cdot 10^{-34}\right) \land t \leq 9 \cdot 10^{+37}:\\
\;\;\;\;y \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7.99999999999999982e38 or -0.299999999999999989 < t < -6.1999999999999996e-34 or 8.99999999999999923e37 < t

    1. Initial program 89.6%

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

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

    if -7.99999999999999982e38 < t < -0.299999999999999989 or -6.1999999999999996e-34 < t < 8.99999999999999923e37

    1. Initial program 98.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -8 \cdot 10^{+38}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -0.3 \lor \neg \left(t \leq -6.2 \cdot 10^{-34}\right) \land t \leq 9 \cdot 10^{+37}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 51.3% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;x \leq -120000000000 \lor \neg \left(x \leq 5.5 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{x \cdot y}{y}\\

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


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

    1. Initial program 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \color{blue}{\frac{x}{-t}} \]
    12. Taylor expanded in y around 0 62.4%

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

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

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

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

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

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

    if -3.1e140 < x < -1.2e11 or 5.5000000000000004e-12 < x

    1. Initial program 92.8%

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

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

        \[\leadsto x + \frac{\color{blue}{-x \cdot y}}{t} \]
      2. distribute-lft-neg-out79.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot x}{y}} \]
    11. Applied egg-rr57.2%

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

    if -1.2e11 < x < 5.5000000000000004e-12

    1. Initial program 96.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 59.2%

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

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

Alternative 5: 73.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-94} \lor \neg \left(x \leq 2.25 \cdot 10^{-85}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.9999999999999996e-95 or 2.25000000000000002e-85 < x

    1. Initial program 94.2%

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

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

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

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

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

    if -9.9999999999999996e-95 < x < 2.25000000000000002e-85

    1. Initial program 95.6%

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

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

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

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

Alternative 6: 77.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -25000000000 \lor \neg \left(x \leq 2.3 \cdot 10^{-15}\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 -25000000000.0) (not (<= x 2.3e-15)))
   (* x (- 1.0 (/ y t)))
   (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -25000000000.0) || !(x <= 2.3e-15)) {
		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 <= (-25000000000.0d0)) .or. (.not. (x <= 2.3d-15))) 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 <= -25000000000.0) || !(x <= 2.3e-15)) {
		tmp = x * (1.0 - (y / t));
	} else {
		tmp = (y / t) * (z - x);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -25000000000.0) or not (x <= 2.3e-15):
		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 <= -25000000000.0) || !(x <= 2.3e-15))
		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 <= -25000000000.0) || ~((x <= 2.3e-15)))
		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, -25000000000.0], N[Not[LessEqual[x, 2.3e-15]], $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 -25000000000 \lor \neg \left(x \leq 2.3 \cdot 10^{-15}\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 < -2.5e10 or 2.2999999999999999e-15 < x

    1. Initial program 93.1%

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

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

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

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

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

    if -2.5e10 < x < 2.2999999999999999e-15

    1. Initial program 96.2%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -25000000000 \lor \neg \left(x \leq 2.3 \cdot 10^{-15}\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 7: 76.5% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.3e9 or 1.29999999999999998e-14 < x

    1. Initial program 93.1%

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

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

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

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

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

    if -4.3e9 < x < 1.29999999999999998e-14

    1. Initial program 96.2%

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

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

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

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

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

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

Alternative 8: 83.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{-48} \lor \neg \left(t \leq 4.8 \cdot 10^{-88}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.80000000000000002e-48 or 4.7999999999999999e-88 < t

    1. Initial program 92.1%

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

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

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

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

    if -3.80000000000000002e-48 < t < 4.7999999999999999e-88

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 83.8% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.5e-45

    1. Initial program 89.5%

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

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

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

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

    if -3.5e-45 < t < 2.4e-87

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.4e-87 < t

    1. Initial program 95.1%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.5 \cdot 10^{-45}:\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \mathbf{elif}\;t \leq 2.4 \cdot 10^{-87}:\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 84.4% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.5e-34

    1. Initial program 89.4%

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

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

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

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

    if -1.5e-34 < t < 7.5000000000000002e-87

    1. Initial program 98.9%

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

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

    if 7.5000000000000002e-87 < t

    1. Initial program 95.1%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{-34}:\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \mathbf{elif}\;t \leq 7.5 \cdot 10^{-87}:\\ \;\;\;\;\frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 52.6% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -660000000000 \lor \neg \left(x \leq 8 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{x \cdot y}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.6e11 or 8.00000000000000065e-5 < x

    1. Initial program 93.0%

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

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

        \[\leadsto x + \frac{\color{blue}{-x \cdot y}}{t} \]
      2. distribute-lft-neg-out82.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot x}{y}} \]
    11. Applied egg-rr54.6%

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

    if -6.6e11 < x < 8.00000000000000065e-5

    1. Initial program 96.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 59.2%

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

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

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

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

Alternative 12: 52.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -135000000000 \lor \neg \left(x \leq 1.55 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{x \cdot y}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.35e11 or 1.55e-8 < x

    1. Initial program 93.0%

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

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

        \[\leadsto x + \frac{\color{blue}{-x \cdot y}}{t} \]
      2. distribute-lft-neg-out82.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot x}{y}} \]
    11. Applied egg-rr54.6%

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

    if -1.35e11 < x < 1.55e-8

    1. Initial program 96.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 59.2%

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

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

Alternative 13: 38.9% accurate, 9.0× speedup?

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

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

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

    \[\leadsto \color{blue}{x} \]
  4. Final simplification38.9%

    \[\leadsto x \]
  5. Add Preprocessing

Developer target: 91.5% 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 2024055 
(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)))