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

Percentage Accurate: 92.7% → 97.9%
Time: 9.8s
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.7% accurate, 1.0× speedup?

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

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

Alternative 1: 97.9% 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 92.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 70.6% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;x \leq -2.5 \cdot 10^{-196} \lor \neg \left(x \leq 3 \cdot 10^{-9}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -3.5000000000000002e-40

    1. Initial program 92.7%

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

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

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

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

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

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

    if -3.5000000000000002e-40 < x < -3.70000000000000014e-118

    1. Initial program 99.6%

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

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

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

    if -3.70000000000000014e-118 < x < -2.5000000000000002e-196 or 2.99999999999999998e-9 < x

    1. Initial program 93.5%

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

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

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

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

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

    if -2.5000000000000002e-196 < x < 2.99999999999999998e-9

    1. Initial program 89.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.5 \cdot 10^{-40}:\\ \;\;\;\;x \cdot \frac{t - y}{t}\\ \mathbf{elif}\;x \leq -3.7 \cdot 10^{-118}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{elif}\;x \leq -2.5 \cdot 10^{-196} \lor \neg \left(x \leq 3 \cdot 10^{-9}\right):\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 70.7% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;x \leq -3.7 \cdot 10^{-196} \lor \neg \left(x \leq 1.32 \cdot 10^{-9}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.9999999999999999e-40 or -2.30000000000000021e-118 < x < -3.7000000000000001e-196 or 1.32e-9 < 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 83.8%

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

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

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

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

    if -1.9999999999999999e-40 < x < -2.30000000000000021e-118

    1. Initial program 99.6%

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

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

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

    if -3.7000000000000001e-196 < x < 1.32e-9

    1. Initial program 89.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{-40}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{-118}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{elif}\;x \leq -3.7 \cdot 10^{-196} \lor \neg \left(x \leq 1.32 \cdot 10^{-9}\right):\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 54.1% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t \leq -1.85 \cdot 10^{-185}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;t \leq 0.48:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.4999999999999999e26 or 0.47999999999999998 < t

    1. Initial program 86.7%

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

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

    if -3.4999999999999999e26 < t < -1.85e-185 or 3.8000000000000002e-262 < t < 0.47999999999999998

    1. Initial program 98.8%

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

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

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

    if -1.85e-185 < t < 3.8000000000000002e-262

    1. Initial program 95.9%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.5 \cdot 10^{+26}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.85 \cdot 10^{-185}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{elif}\;t \leq 3.8 \cdot 10^{-262}:\\ \;\;\;\;x \cdot \frac{y}{-t}\\ \mathbf{elif}\;t \leq 0.48:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 85.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+28} \lor \neg \left(y \leq 2.25 \cdot 10^{+61}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.39999999999999981e28 or 2.25e61 < y

    1. Initial program 85.9%

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

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

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

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

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

    if -2.39999999999999981e28 < y < 2.25e61

    1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 76.9% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.8999999999999999e32 or 5.6000000000000003e-39 < y

    1. Initial program 87.9%

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

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

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

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

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

    if -3.8999999999999999e32 < y < 5.6000000000000003e-39

    1. Initial program 97.6%

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

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

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

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

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

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

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

Alternative 7: 84.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.011:\\
\;\;\;\;x \cdot \frac{t - y}{t}\\

\mathbf{elif}\;x \leq 20000:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\

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


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

    1. Initial program 91.9%

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

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

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

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

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

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

    if -0.010999999999999999 < x < 2e4

    1. Initial program 92.6%

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

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

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

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

    if 2e4 < x

    1. Initial program 94.3%

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

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

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

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

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

Alternative 8: 54.1% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.99999999999999989e34 or 2.30000000000000002e-38 < y

    1. Initial program 87.9%

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

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

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

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

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

    if -1.99999999999999989e34 < y < 2.30000000000000002e-38

    1. Initial program 97.6%

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

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

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

Alternative 9: 54.7% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t \leq 3:\\
\;\;\;\;\frac{y \cdot z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.8e26 or 3 < t

    1. Initial program 86.7%

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

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

    if -2.8e26 < t < 3

    1. Initial program 97.8%

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

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

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

Alternative 10: 52.5% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.9000000000000001e26 or 0.47999999999999998 < t

    1. Initial program 86.7%

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

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

    if -1.9000000000000001e26 < t < 0.47999999999999998

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

Alternative 11: 39.1% 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.8%

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

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

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

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

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