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

Percentage Accurate: 92.5% → 97.6%
Time: 7.3s
Alternatives: 7
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 7 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: 97.6% accurate, 1.0× speedup?

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

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

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

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

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

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

Alternative 2: 85.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-61} \lor \neg \left(x \leq 1.55 \cdot 10^{+45}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9e-61 or 1.54999999999999994e45 < x

    1. Initial program 89.8%

      \[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 95.7%

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

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

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

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

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

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

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

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

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

    if -9e-61 < x < 1.54999999999999994e45

    1. Initial program 95.3%

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

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

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

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

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

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

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

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

Alternative 3: 85.2% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;x \leq 4.5 \cdot 10^{+43}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\

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


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

    1. Initial program 91.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 96.1%

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

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

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

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

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

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

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

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

    if -1.25e-60 < x < 4.5e43

    1. Initial program 95.3%

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

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

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

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

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

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

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

    if 4.5e43 < x

    1. Initial program 88.1%

      \[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 95.4%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.25 \cdot 10^{-60}:\\ \;\;\;\;x - x \cdot \frac{y}{t}\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{+43}:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \end{array} \]

Alternative 4: 49.0% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \cdot 10^{-46} \lor \neg \left(y \leq 6.2 \cdot 10^{-79}\right):\\
\;\;\;\;\frac{y}{t} \cdot \left(-x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.9000000000000003e-46 or 6.1999999999999999e-79 < y

    1. Initial program 88.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x - x \cdot \frac{y}{t}} \]
    7. Taylor expanded in y around inf 47.8%

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

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

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

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

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

    if -3.9000000000000003e-46 < y < 6.1999999999999999e-79

    1. Initial program 98.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.9 \cdot 10^{-46} \lor \neg \left(y \leq 6.2 \cdot 10^{-79}\right):\\ \;\;\;\;\frac{y}{t} \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 5: 49.1% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{-44} \lor \neg \left(y \leq 5.2 \cdot 10^{-77}\right):\\
\;\;\;\;\frac{x}{\frac{t}{-y}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.80000000000000033e-44 or 5.2000000000000002e-77 < y

    1. Initial program 88.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x - x \cdot \frac{y}{t}} \]
    7. Taylor expanded in y around inf 47.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{t}{-y}}} \]
    9. Simplified53.0%

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

    if -6.80000000000000033e-44 < y < 5.2000000000000002e-77

    1. Initial program 98.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.8 \cdot 10^{-44} \lor \neg \left(y \leq 5.2 \cdot 10^{-77}\right):\\ \;\;\;\;\frac{x}{\frac{t}{-y}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 6: 65.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ x \cdot \left(1 - \frac{y}{t}\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (* x (- 1.0 (/ y t))))
double code(double x, double y, double z, double t) {
	return x * (1.0 - (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 * (1.0d0 - (y / t))
end function
public static double code(double x, double y, double z, double t) {
	return x * (1.0 - (y / t));
}
def code(x, y, z, t):
	return x * (1.0 - (y / t))
function code(x, y, z, t)
	return Float64(x * Float64(1.0 - Float64(y / t)))
end
function tmp = code(x, y, z, t)
	tmp = x * (1.0 - (y / t));
end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 38.6% 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.3%

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

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

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification31.1%

    \[\leadsto x \]

Developer target: 90.9% accurate, 0.6× speedup?

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

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

Reproduce

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