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

Percentage Accurate: 92.5% → 98.1%
Time: 7.5s
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.5% accurate, 1.0× speedup?

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

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

Alternative 1: 98.1% accurate, 1.0× speedup?

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

\\
x + \frac{z - x}{\frac{t}{y}}
\end{array}
Derivation
  1. Initial program 92.5%

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

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

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

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

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

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

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

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

Alternative 2: 51.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.45 \cdot 10^{+294}:\\
\;\;\;\;x\\

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

\mathbf{elif}\;x \leq -5.4 \cdot 10^{+39}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.4499999999999999e294 or -3.7999999999999998e177 < x < -5.40000000000000007e39 or 1.7999999999999999e-13 < x

    1. Initial program 93.7%

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

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

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

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

    if -2.4499999999999999e294 < x < -3.7999999999999998e177

    1. Initial program 92.6%

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

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

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

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

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

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

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

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

    if -5.40000000000000007e39 < x < 1.7999999999999999e-13

    1. Initial program 91.3%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{t} \cdot z} \]
    9. Applied egg-rr62.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.45 \cdot 10^{+294}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{+177}:\\ \;\;\;\;\frac{x}{t} \cdot \left(-y\right)\\ \mathbf{elif}\;x \leq -5.4 \cdot 10^{+39}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-13}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 3: 52.0% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+293}:\\
\;\;\;\;x\\

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

\mathbf{elif}\;x \leq -1.35 \cdot 10^{+40}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.1999999999999998e293 or -1.2e177 < x < -1.35000000000000005e40 or 9.4000000000000003e-14 < x

    1. Initial program 93.7%

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

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

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

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

    if -6.1999999999999998e293 < x < -1.2e177

    1. Initial program 92.6%

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \color{blue}{\frac{-\left(-x\right)}{-t}} \]
      2. remove-double-neg70.5%

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

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

      \[\leadsto \color{blue}{\frac{y \cdot x}{-t}} \]
    10. Step-by-step derivation
      1. frac-2neg70.6%

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

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

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

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

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

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

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

    if -1.35000000000000005e40 < x < 9.4000000000000003e-14

    1. Initial program 91.3%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{t} \cdot z} \]
    9. Applied egg-rr62.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.2 \cdot 10^{+293}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{+177}:\\ \;\;\;\;x \cdot \frac{-y}{t}\\ \mathbf{elif}\;x \leq -1.35 \cdot 10^{+40}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 9.4 \cdot 10^{-14}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 4: 72.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-78} \lor \neg \left(y \leq 1.2 \cdot 10^{-82}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.2e-78 or 1.20000000000000004e-82 < y

    1. Initial program 89.1%

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

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

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

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

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

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

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

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

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

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

    if -3.2e-78 < y < 1.20000000000000004e-82

    1. Initial program 97.2%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{-78} \lor \neg \left(y \leq 1.2 \cdot 10^{-82}\right):\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 5: 83.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-11} \lor \neg \left(y \leq 2.1 \cdot 10^{-34}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.19999999999999969e-11 or 2.1000000000000001e-34 < y

    1. Initial program 87.8%

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

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

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

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

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(\frac{z}{t} - \frac{x}{t}\right)} \]
      4. div-sub81.9%

        \[\leadsto y \cdot \color{blue}{\frac{z - x}{t}} \]
    7. Simplified81.9%

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

    if -7.19999999999999969e-11 < y < 2.1000000000000001e-34

    1. Initial program 97.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.2 \cdot 10^{-11} \lor \neg \left(y \leq 2.1 \cdot 10^{-34}\right):\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \frac{y}{t}\\ \end{array} \]

Alternative 6: 83.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-15} \lor \neg \left(y \leq 1.55 \cdot 10^{-34}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.49999999999999991e-15 or 1.5499999999999999e-34 < y

    1. Initial program 87.8%

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

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

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

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

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(\frac{z}{t} - \frac{x}{t}\right)} \]
      4. div-sub81.9%

        \[\leadsto y \cdot \color{blue}{\frac{z - x}{t}} \]
    7. Simplified81.9%

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

    if -6.49999999999999991e-15 < y < 1.5499999999999999e-34

    1. Initial program 97.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.5 \cdot 10^{-15} \lor \neg \left(y \leq 1.55 \cdot 10^{-34}\right):\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z \cdot y}{t}\\ \end{array} \]

Alternative 7: 86.1% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.1999999999999999e63 or 7.99999999999999984e-12 < x

    1. Initial program 93.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + -1 \cdot \color{blue}{\frac{x \cdot y}{t}} \]
      9. mul-1-neg87.2%

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

        \[\leadsto \color{blue}{x - \frac{x \cdot y}{t}} \]
      11. associate-*r/93.9%

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

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

    if -2.1999999999999999e63 < x < 7.99999999999999984e-12

    1. Initial program 91.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.2 \cdot 10^{+63} \lor \neg \left(x \leq 8 \cdot 10^{-12}\right):\\ \;\;\;\;x - x \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \frac{y}{t}\\ \end{array} \]

Alternative 8: 51.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+40}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.1000000000000001e40 or 3.5000000000000002e-14 < x

    1. Initial program 93.5%

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

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

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

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

    if -2.1000000000000001e40 < x < 3.5000000000000002e-14

    1. Initial program 91.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{+40}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-14}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 9: 52.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+40}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.80000000000000004e40 or 5.3999999999999997e-14 < x

    1. Initial program 93.5%

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

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

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

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

    if -3.80000000000000004e40 < x < 5.3999999999999997e-14

    1. Initial program 91.3%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{t} \cdot z} \]
    9. Applied egg-rr62.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{+40}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{-14}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 10: 97.9% accurate, 1.0× speedup?

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

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

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

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

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

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

Alternative 11: 38.3% 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 92.5%

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

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

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification41.0%

    \[\leadsto x \]

Developer target: 91.1% accurate, 0.6× speedup?

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

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

Reproduce

?
herbie shell --seed 2023293 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
  :precision binary64

  :herbie-target
  (- x (+ (* x (/ y t)) (* (- z) (/ y t))))

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