Numeric.AD.Rank1.Halley:findZero from ad-4.2.4

Percentage Accurate: 82.1% → 94.9%
Time: 9.7s
Alternatives: 7
Speedup: 0.6×

Specification

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

\\
x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot 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: 82.1% accurate, 1.0× speedup?

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

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

Alternative 1: 94.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6.1 \cdot 10^{+116}:\\ \;\;\;\;\mathsf{fma}\left(y, 2 \cdot \frac{-0.5}{z}, x\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+68}:\\ \;\;\;\;x + \frac{\frac{2}{y} \cdot \left(y \cdot z\right)}{t - \frac{z \cdot \left(2 \cdot z\right)}{y}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -6.1e+116)
   (fma y (* 2.0 (/ -0.5 z)) x)
   (if (<= z 1.8e+68)
     (+ x (/ (* (/ 2.0 y) (* y z)) (- t (/ (* z (* 2.0 z)) y))))
     (- x (/ y z)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -6.1e+116) {
		tmp = fma(y, (2.0 * (-0.5 / z)), x);
	} else if (z <= 1.8e+68) {
		tmp = x + (((2.0 / y) * (y * z)) / (t - ((z * (2.0 * z)) / y)));
	} else {
		tmp = x - (y / z);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -6.1e+116)
		tmp = fma(y, Float64(2.0 * Float64(-0.5 / z)), x);
	elseif (z <= 1.8e+68)
		tmp = Float64(x + Float64(Float64(Float64(2.0 / y) * Float64(y * z)) / Float64(t - Float64(Float64(z * Float64(2.0 * z)) / y))));
	else
		tmp = Float64(x - Float64(y / z));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.1e+116], N[(y * N[(2.0 * N[(-0.5 / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.8e+68], N[(x + N[(N[(N[(2.0 / y), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(N[(z * N[(2.0 * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.1 \cdot 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(y, 2 \cdot \frac{-0.5}{z}, x\right)\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{+68}:\\
\;\;\;\;x + \frac{\frac{2}{y} \cdot \left(y \cdot z\right)}{t - \frac{z \cdot \left(2 \cdot z\right)}{y}}\\

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


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

    1. Initial program 77.0%

      \[x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t} \]
    2. Step-by-step derivation
      1. sub-neg77.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, -2 \cdot \frac{z}{\left(z \cdot 2\right) \cdot z - y \cdot t}, x\right)} \]
    3. Simplified90.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 2 \cdot \frac{z}{\mathsf{fma}\left(-2, z \cdot z, y \cdot t\right)}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 94.5%

      \[\leadsto \mathsf{fma}\left(y, 2 \cdot \color{blue}{\frac{-0.5}{z}}, x\right) \]

    if -6.10000000000000018e116 < z < 1.7999999999999999e68

    1. Initial program 93.0%

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

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

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

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

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

        \[\leadsto x - \frac{\left(y \cdot 2\right) \cdot z}{y \cdot \left(\frac{\color{blue}{\left(2 \cdot z\right) \cdot z}}{y} - t\right)} \]
    7. Applied egg-rr92.9%

      \[\leadsto x - \frac{\left(y \cdot 2\right) \cdot z}{y \cdot \left(\frac{\color{blue}{\left(2 \cdot z\right) \cdot z}}{y} - t\right)} \]
    8. Step-by-step derivation
      1. *-commutative92.9%

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

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

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

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

        \[\leadsto x - \frac{2}{y} \cdot \frac{z \cdot y}{\frac{\color{blue}{2 \cdot \left(z \cdot z\right)}}{y} - t} \]
      6. *-un-lft-identity92.8%

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

        \[\leadsto x - \frac{2}{y} \cdot \frac{z \cdot y}{\color{blue}{\frac{2}{1} \cdot \frac{z \cdot z}{y}} - t} \]
      8. metadata-eval92.8%

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

        \[\leadsto x - \frac{2}{y} \cdot \frac{z \cdot y}{2 \cdot \frac{\color{blue}{{z}^{2}}}{y} - t} \]
    9. Applied egg-rr92.8%

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

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

        \[\leadsto x - \frac{\frac{2}{y} \cdot \left(z \cdot y\right)}{\color{blue}{\frac{2 \cdot {z}^{2}}{y}} - t} \]
    11. Simplified96.2%

      \[\leadsto x - \color{blue}{\frac{\frac{2}{y} \cdot \left(z \cdot y\right)}{\frac{2 \cdot {z}^{2}}{y} - t}} \]
    12. Step-by-step derivation
      1. unpow292.9%

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

        \[\leadsto x - \frac{\left(y \cdot 2\right) \cdot z}{y \cdot \left(\frac{\color{blue}{\left(2 \cdot z\right) \cdot z}}{y} - t\right)} \]
    13. Applied egg-rr96.2%

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

    if 1.7999999999999999e68 < z

    1. Initial program 67.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.1 \cdot 10^{+116}:\\ \;\;\;\;\mathsf{fma}\left(y, 2 \cdot \frac{-0.5}{z}, x\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+68}:\\ \;\;\;\;x + \frac{\frac{2}{y} \cdot \left(y \cdot z\right)}{t - \frac{z \cdot \left(2 \cdot z\right)}{y}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 94.1% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\left(y \cdot 2\right) \cdot z}{z \cdot \left(2 \cdot z\right) - y \cdot t} \leq 2 \cdot 10^{+170}:\\ \;\;\;\;\mathsf{fma}\left(y, 2 \cdot \frac{z}{\mathsf{fma}\left(-2, z \cdot z, y \cdot t\right)}, x\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (/ (* (* y 2.0) z) (- (* z (* 2.0 z)) (* y t))) 2e+170)
   (fma y (* 2.0 (/ z (fma -2.0 (* z z) (* y t)))) x)
   (- x (/ y z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((((y * 2.0) * z) / ((z * (2.0 * z)) - (y * t))) <= 2e+170) {
		tmp = fma(y, (2.0 * (z / fma(-2.0, (z * z), (y * t)))), x);
	} else {
		tmp = x - (y / z);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(Float64(Float64(y * 2.0) * z) / Float64(Float64(z * Float64(2.0 * z)) - Float64(y * t))) <= 2e+170)
		tmp = fma(y, Float64(2.0 * Float64(z / fma(-2.0, Float64(z * z), Float64(y * t)))), x);
	else
		tmp = Float64(x - Float64(y / z));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(N[(y * 2.0), $MachinePrecision] * z), $MachinePrecision] / N[(N[(z * N[(2.0 * z), $MachinePrecision]), $MachinePrecision] - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+170], N[(y * N[(2.0 * N[(z / N[(-2.0 * N[(z * z), $MachinePrecision] + N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\left(y \cdot 2\right) \cdot z}{z \cdot \left(2 \cdot z\right) - y \cdot t} \leq 2 \cdot 10^{+170}:\\
\;\;\;\;\mathsf{fma}\left(y, 2 \cdot \frac{z}{\mathsf{fma}\left(-2, z \cdot z, y \cdot t\right)}, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 (*.f64 y #s(literal 2 binary64)) z) (-.f64 (*.f64 (*.f64 z #s(literal 2 binary64)) z) (*.f64 y t))) < 2.00000000000000007e170

    1. Initial program 95.7%

      \[x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t} \]
    2. Step-by-step derivation
      1. sub-neg95.7%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, -2 \cdot \frac{z}{\left(z \cdot 2\right) \cdot z - y \cdot t}, x\right)} \]
    3. Simplified97.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 2 \cdot \frac{z}{\mathsf{fma}\left(-2, z \cdot z, y \cdot t\right)}, x\right)} \]
    4. Add Preprocessing

    if 2.00000000000000007e170 < (/.f64 (*.f64 (*.f64 y #s(literal 2 binary64)) z) (-.f64 (*.f64 (*.f64 z #s(literal 2 binary64)) z) (*.f64 y t)))

    1. Initial program 0.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(y \cdot 2\right) \cdot z}{z \cdot \left(2 \cdot z\right) - y \cdot t} \leq 2 \cdot 10^{+170}:\\ \;\;\;\;\mathsf{fma}\left(y, 2 \cdot \frac{z}{\mathsf{fma}\left(-2, z \cdot z, y \cdot t\right)}, x\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 93.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y \cdot 2\right) \cdot z\\ t_2 := z \cdot \left(2 \cdot z\right)\\ \mathbf{if}\;\frac{t\_1}{t\_2 - y \cdot t} \leq 2 \cdot 10^{+170}:\\ \;\;\;\;x + \frac{t\_1}{y \cdot t - t\_2}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (* y 2.0) z)) (t_2 (* z (* 2.0 z))))
   (if (<= (/ t_1 (- t_2 (* y t))) 2e+170)
     (+ x (/ t_1 (- (* y t) t_2)))
     (- x (/ y z)))))
double code(double x, double y, double z, double t) {
	double t_1 = (y * 2.0) * z;
	double t_2 = z * (2.0 * z);
	double tmp;
	if ((t_1 / (t_2 - (y * t))) <= 2e+170) {
		tmp = x + (t_1 / ((y * t) - t_2));
	} else {
		tmp = x - (y / 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (y * 2.0d0) * z
    t_2 = z * (2.0d0 * z)
    if ((t_1 / (t_2 - (y * t))) <= 2d+170) then
        tmp = x + (t_1 / ((y * t) - t_2))
    else
        tmp = x - (y / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (y * 2.0) * z;
	double t_2 = z * (2.0 * z);
	double tmp;
	if ((t_1 / (t_2 - (y * t))) <= 2e+170) {
		tmp = x + (t_1 / ((y * t) - t_2));
	} else {
		tmp = x - (y / z);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (y * 2.0) * z
	t_2 = z * (2.0 * z)
	tmp = 0
	if (t_1 / (t_2 - (y * t))) <= 2e+170:
		tmp = x + (t_1 / ((y * t) - t_2))
	else:
		tmp = x - (y / z)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(y * 2.0) * z)
	t_2 = Float64(z * Float64(2.0 * z))
	tmp = 0.0
	if (Float64(t_1 / Float64(t_2 - Float64(y * t))) <= 2e+170)
		tmp = Float64(x + Float64(t_1 / Float64(Float64(y * t) - t_2)));
	else
		tmp = Float64(x - Float64(y / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (y * 2.0) * z;
	t_2 = z * (2.0 * z);
	tmp = 0.0;
	if ((t_1 / (t_2 - (y * t))) <= 2e+170)
		tmp = x + (t_1 / ((y * t) - t_2));
	else
		tmp = x - (y / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * 2.0), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 / N[(t$95$2 - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+170], N[(x + N[(t$95$1 / N[(N[(y * t), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 (*.f64 y #s(literal 2 binary64)) z) (-.f64 (*.f64 (*.f64 z #s(literal 2 binary64)) z) (*.f64 y t))) < 2.00000000000000007e170

    1. Initial program 95.7%

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

    if 2.00000000000000007e170 < (/.f64 (*.f64 (*.f64 y #s(literal 2 binary64)) z) (-.f64 (*.f64 (*.f64 z #s(literal 2 binary64)) z) (*.f64 y t)))

    1. Initial program 0.6%

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

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

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

Alternative 4: 95.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+115} \lor \neg \left(z \leq 2.9 \cdot 10^{+69}\right):\\
\;\;\;\;x - \frac{y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.50000000000000004e115 or 2.8999999999999998e69 < z

    1. Initial program 70.7%

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

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

    if -2.50000000000000004e115 < z < 2.8999999999999998e69

    1. Initial program 93.0%

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

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

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

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

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

        \[\leadsto x - \frac{\left(y \cdot 2\right) \cdot z}{y \cdot \left(\frac{\color{blue}{\left(2 \cdot z\right) \cdot z}}{y} - t\right)} \]
    7. Applied egg-rr92.9%

      \[\leadsto x - \frac{\left(y \cdot 2\right) \cdot z}{y \cdot \left(\frac{\color{blue}{\left(2 \cdot z\right) \cdot z}}{y} - t\right)} \]
    8. Step-by-step derivation
      1. *-commutative92.9%

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

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

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

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

        \[\leadsto x - \frac{2}{y} \cdot \frac{z \cdot y}{\frac{\color{blue}{2 \cdot \left(z \cdot z\right)}}{y} - t} \]
      6. *-un-lft-identity92.8%

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

        \[\leadsto x - \frac{2}{y} \cdot \frac{z \cdot y}{\color{blue}{\frac{2}{1} \cdot \frac{z \cdot z}{y}} - t} \]
      8. metadata-eval92.8%

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

        \[\leadsto x - \frac{2}{y} \cdot \frac{z \cdot y}{2 \cdot \frac{\color{blue}{{z}^{2}}}{y} - t} \]
    9. Applied egg-rr92.8%

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

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

        \[\leadsto x - \frac{\frac{2}{y} \cdot \left(z \cdot y\right)}{\color{blue}{\frac{2 \cdot {z}^{2}}{y}} - t} \]
    11. Simplified96.2%

      \[\leadsto x - \color{blue}{\frac{\frac{2}{y} \cdot \left(z \cdot y\right)}{\frac{2 \cdot {z}^{2}}{y} - t}} \]
    12. Step-by-step derivation
      1. unpow292.9%

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

        \[\leadsto x - \frac{\left(y \cdot 2\right) \cdot z}{y \cdot \left(\frac{\color{blue}{\left(2 \cdot z\right) \cdot z}}{y} - t\right)} \]
    13. Applied egg-rr96.2%

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

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

Alternative 5: 88.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x - \frac{y}{z}\\ t_2 := x - -2 \cdot \frac{z}{t}\\ \mathbf{if}\;z \leq -8.5 \cdot 10^{+17}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-73}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{+28}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{+60}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- x (/ y z))) (t_2 (- x (* -2.0 (/ z t)))))
   (if (<= z -8.5e+17)
     t_1
     (if (<= z 1.4e-73)
       t_2
       (if (<= z 2.4e+28) x (if (<= z 1.05e+60) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = x - (y / z);
	double t_2 = x - (-2.0 * (z / t));
	double tmp;
	if (z <= -8.5e+17) {
		tmp = t_1;
	} else if (z <= 1.4e-73) {
		tmp = t_2;
	} else if (z <= 2.4e+28) {
		tmp = x;
	} else if (z <= 1.05e+60) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x - (y / z)
    t_2 = x - ((-2.0d0) * (z / t))
    if (z <= (-8.5d+17)) then
        tmp = t_1
    else if (z <= 1.4d-73) then
        tmp = t_2
    else if (z <= 2.4d+28) then
        tmp = x
    else if (z <= 1.05d+60) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x - (y / z);
	double t_2 = x - (-2.0 * (z / t));
	double tmp;
	if (z <= -8.5e+17) {
		tmp = t_1;
	} else if (z <= 1.4e-73) {
		tmp = t_2;
	} else if (z <= 2.4e+28) {
		tmp = x;
	} else if (z <= 1.05e+60) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x - (y / z)
	t_2 = x - (-2.0 * (z / t))
	tmp = 0
	if z <= -8.5e+17:
		tmp = t_1
	elif z <= 1.4e-73:
		tmp = t_2
	elif z <= 2.4e+28:
		tmp = x
	elif z <= 1.05e+60:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x - Float64(y / z))
	t_2 = Float64(x - Float64(-2.0 * Float64(z / t)))
	tmp = 0.0
	if (z <= -8.5e+17)
		tmp = t_1;
	elseif (z <= 1.4e-73)
		tmp = t_2;
	elseif (z <= 2.4e+28)
		tmp = x;
	elseif (z <= 1.05e+60)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x - (y / z);
	t_2 = x - (-2.0 * (z / t));
	tmp = 0.0;
	if (z <= -8.5e+17)
		tmp = t_1;
	elseif (z <= 1.4e-73)
		tmp = t_2;
	elseif (z <= 2.4e+28)
		tmp = x;
	elseif (z <= 1.05e+60)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(-2.0 * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e+17], t$95$1, If[LessEqual[z, 1.4e-73], t$95$2, If[LessEqual[z, 2.4e+28], x, If[LessEqual[z, 1.05e+60], t$95$2, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x - \frac{y}{z}\\
t_2 := x - -2 \cdot \frac{z}{t}\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1.4 \cdot 10^{-73}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq 2.4 \cdot 10^{+28}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.05 \cdot 10^{+60}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -8.5e17 or 1.0500000000000001e60 < z

    1. Initial program 74.1%

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

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

    if -8.5e17 < z < 1.40000000000000006e-73 or 2.39999999999999981e28 < z < 1.0500000000000001e60

    1. Initial program 92.9%

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

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

    if 1.40000000000000006e-73 < z < 2.39999999999999981e28

    1. Initial program 96.0%

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 81.6% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+23} \lor \neg \left(z \leq 1.35 \cdot 10^{+60}\right):\\
\;\;\;\;x - \frac{y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.25e23 or 1.35e60 < z

    1. Initial program 73.6%

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

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

    if -1.25e23 < z < 1.35e60

    1. Initial program 93.5%

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

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

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

Alternative 7: 74.6% accurate, 17.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 85.3%

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

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

Developer target: 99.9% accurate, 1.3× speedup?

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

\\
x - \frac{1}{\frac{z}{y} - \frac{\frac{t}{2}}{z}}
\end{array}

Reproduce

?
herbie shell --seed 2024096 
(FPCore (x y z t)
  :name "Numeric.AD.Rank1.Halley:findZero from ad-4.2.4"
  :precision binary64

  :alt
  (- x (/ 1.0 (- (/ z y) (/ (/ t 2.0) z))))

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