Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B

Percentage Accurate: 90.9% → 96.1%
Time: 14.0s
Alternatives: 9
Speedup: 0.6×

Specification

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

\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\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 9 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: 90.9% accurate, 1.0× speedup?

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

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

Alternative 1: 96.1% accurate, 0.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z\_m \leq 1.25 \cdot 10^{+158}:\\ \;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z\_m \cdot z\_m, x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(z\_m \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z\_m}^{7}}} \cdot \left(4 \cdot \frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}}\right)\right) + \sqrt[3]{-4} \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{\frac{1}{z\_m}}\right)\right)\right)}^{3}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (if (<= z_m 1.25e+158)
   (fma (* y 4.0) (- t (* z_m z_m)) (* x x))
   (pow
    (*
     z_m
     (+
      (*
       0.3333333333333333
       (* (cbrt (/ y (pow z_m 7.0))) (* 4.0 (/ t (pow (cbrt -4.0) 2.0)))))
      (* (cbrt -4.0) (* (cbrt y) (cbrt (/ 1.0 z_m))))))
    3.0)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if (z_m <= 1.25e+158) {
		tmp = fma((y * 4.0), (t - (z_m * z_m)), (x * x));
	} else {
		tmp = pow((z_m * ((0.3333333333333333 * (cbrt((y / pow(z_m, 7.0))) * (4.0 * (t / pow(cbrt(-4.0), 2.0))))) + (cbrt(-4.0) * (cbrt(y) * cbrt((1.0 / z_m)))))), 3.0);
	}
	return tmp;
}
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (z_m <= 1.25e+158)
		tmp = fma(Float64(y * 4.0), Float64(t - Float64(z_m * z_m)), Float64(x * x));
	else
		tmp = Float64(z_m * Float64(Float64(0.3333333333333333 * Float64(cbrt(Float64(y / (z_m ^ 7.0))) * Float64(4.0 * Float64(t / (cbrt(-4.0) ^ 2.0))))) + Float64(cbrt(-4.0) * Float64(cbrt(y) * cbrt(Float64(1.0 / z_m)))))) ^ 3.0;
	end
	return tmp
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 1.25e+158], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[Power[N[(z$95$m * N[(N[(0.3333333333333333 * N[(N[Power[N[(y / N[Power[z$95$m, 7.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * N[(4.0 * N[(t / N[Power[N[Power[-4.0, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[-4.0, 1/3], $MachinePrecision] * N[(N[Power[y, 1/3], $MachinePrecision] * N[Power[N[(1.0 / z$95$m), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 1.25 \cdot 10^{+158}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z\_m \cdot z\_m, x \cdot x\right)\\

\mathbf{else}:\\
\;\;\;\;{\left(z\_m \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z\_m}^{7}}} \cdot \left(4 \cdot \frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}}\right)\right) + \sqrt[3]{-4} \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{\frac{1}{z\_m}}\right)\right)\right)}^{3}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.2499999999999999e158

    1. Initial program 91.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv91.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot 4\right) \cdot \left(-\left(z \cdot z - t\right)\right)} + x \cdot x \]
      8. fma-define94.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot 4, -\left(z \cdot z - t\right), x \cdot x\right)} \]
      9. sub-neg94.0%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, -\color{blue}{\left(z \cdot z + \left(-t\right)\right)}, x \cdot x\right) \]
      10. +-commutative94.0%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, -\color{blue}{\left(\left(-t\right) + z \cdot z\right)}, x \cdot x\right) \]
      11. distribute-neg-in94.0%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, \color{blue}{\left(-\left(-t\right)\right) + \left(-z \cdot z\right)}, x \cdot x\right) \]
      12. remove-double-neg94.0%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, \color{blue}{t} + \left(-z \cdot z\right), x \cdot x\right) \]
      13. sub-neg94.0%

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

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

    if 1.2499999999999999e158 < z

    1. Initial program 70.7%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. fma-neg74.5%

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

        \[\leadsto \mathsf{fma}\left(x, x, -\color{blue}{\left(z \cdot z - t\right) \cdot \left(y \cdot 4\right)}\right) \]
      3. distribute-rgt-neg-in74.5%

        \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\left(z \cdot z - t\right) \cdot \left(-y \cdot 4\right)}\right) \]
      4. distribute-rgt-neg-in74.5%

        \[\leadsto \mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \color{blue}{\left(y \cdot \left(-4\right)\right)}\right) \]
      5. metadata-eval74.5%

        \[\leadsto \mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot \color{blue}{-4}\right)\right) \]
      6. add-cube-cbrt74.5%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)}} \]
      7. pow374.5%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)}\right)}^{3}} \]
    4. Applied egg-rr74.5%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(x, x, y \cdot \left(-4 \cdot \left({z}^{2} - t\right)\right)\right)}\right)}^{3}} \]
    5. Taylor expanded in z around inf 53.8%

      \[\leadsto {\color{blue}{\left(z \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{1}{{y}^{2} \cdot {z}^{7}}} \cdot \frac{4 \cdot \left(t \cdot y\right) + {x}^{2}}{{\left(\sqrt[3]{-4}\right)}^{2}}\right) + \sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{-4}\right)\right)}}^{3} \]
    6. Taylor expanded in y around inf 65.9%

      \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \color{blue}{\left(4 \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot \sqrt[3]{\frac{y}{{z}^{7}}}\right)\right)} + \sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
    7. Step-by-step derivation
      1. *-commutative65.9%

        \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \color{blue}{\left(\left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot \sqrt[3]{\frac{y}{{z}^{7}}}\right) \cdot 4\right)} + \sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
      2. *-commutative65.9%

        \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \left(\color{blue}{\left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}}\right)} \cdot 4\right) + \sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
      3. associate-*l*65.9%

        \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \color{blue}{\left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot 4\right)\right)} + \sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
    8. Simplified65.9%

      \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \color{blue}{\left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot 4\right)\right)} + \sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
    9. Step-by-step derivation
      1. pow1/319.9%

        \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot 4\right)\right) + \color{blue}{{\left(\frac{y}{z}\right)}^{0.3333333333333333}} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
      2. div-inv19.9%

        \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot 4\right)\right) + {\color{blue}{\left(y \cdot \frac{1}{z}\right)}}^{0.3333333333333333} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
      3. unpow-prod-down29.8%

        \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot 4\right)\right) + \color{blue}{\left({y}^{0.3333333333333333} \cdot {\left(\frac{1}{z}\right)}^{0.3333333333333333}\right)} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
      4. pow1/390.3%

        \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot 4\right)\right) + \left(\color{blue}{\sqrt[3]{y}} \cdot {\left(\frac{1}{z}\right)}^{0.3333333333333333}\right) \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
    10. Applied egg-rr90.3%

      \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot 4\right)\right) + \color{blue}{\left(\sqrt[3]{y} \cdot {\left(\frac{1}{z}\right)}^{0.3333333333333333}\right)} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
    11. Step-by-step derivation
      1. unpow1/392.3%

        \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot 4\right)\right) + \left(\sqrt[3]{y} \cdot \color{blue}{\sqrt[3]{\frac{1}{z}}}\right) \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
    12. Simplified92.3%

      \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot 4\right)\right) + \color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{\frac{1}{z}}\right)} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.9%

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

Alternative 2: 96.1% accurate, 0.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z\_m \leq 1.25 \cdot 10^{+158}:\\ \;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z\_m \cdot z\_m, x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(z\_m \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z\_m}^{7}}} \cdot \left(4 \cdot \frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}}\right)\right) + \sqrt[3]{-4} \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{z\_m}}\right)\right)}^{3}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (if (<= z_m 1.25e+158)
   (fma (* y 4.0) (- t (* z_m z_m)) (* x x))
   (pow
    (*
     z_m
     (+
      (*
       0.3333333333333333
       (* (cbrt (/ y (pow z_m 7.0))) (* 4.0 (/ t (pow (cbrt -4.0) 2.0)))))
      (* (cbrt -4.0) (/ (cbrt y) (cbrt z_m)))))
    3.0)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if (z_m <= 1.25e+158) {
		tmp = fma((y * 4.0), (t - (z_m * z_m)), (x * x));
	} else {
		tmp = pow((z_m * ((0.3333333333333333 * (cbrt((y / pow(z_m, 7.0))) * (4.0 * (t / pow(cbrt(-4.0), 2.0))))) + (cbrt(-4.0) * (cbrt(y) / cbrt(z_m))))), 3.0);
	}
	return tmp;
}
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (z_m <= 1.25e+158)
		tmp = fma(Float64(y * 4.0), Float64(t - Float64(z_m * z_m)), Float64(x * x));
	else
		tmp = Float64(z_m * Float64(Float64(0.3333333333333333 * Float64(cbrt(Float64(y / (z_m ^ 7.0))) * Float64(4.0 * Float64(t / (cbrt(-4.0) ^ 2.0))))) + Float64(cbrt(-4.0) * Float64(cbrt(y) / cbrt(z_m))))) ^ 3.0;
	end
	return tmp
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 1.25e+158], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[Power[N[(z$95$m * N[(N[(0.3333333333333333 * N[(N[Power[N[(y / N[Power[z$95$m, 7.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * N[(4.0 * N[(t / N[Power[N[Power[-4.0, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[-4.0, 1/3], $MachinePrecision] * N[(N[Power[y, 1/3], $MachinePrecision] / N[Power[z$95$m, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 1.25 \cdot 10^{+158}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z\_m \cdot z\_m, x \cdot x\right)\\

\mathbf{else}:\\
\;\;\;\;{\left(z\_m \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z\_m}^{7}}} \cdot \left(4 \cdot \frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}}\right)\right) + \sqrt[3]{-4} \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{z\_m}}\right)\right)}^{3}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.2499999999999999e158

    1. Initial program 91.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv91.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot 4\right) \cdot \left(-\left(z \cdot z - t\right)\right)} + x \cdot x \]
      8. fma-define94.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot 4, -\left(z \cdot z - t\right), x \cdot x\right)} \]
      9. sub-neg94.0%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, -\color{blue}{\left(z \cdot z + \left(-t\right)\right)}, x \cdot x\right) \]
      10. +-commutative94.0%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, -\color{blue}{\left(\left(-t\right) + z \cdot z\right)}, x \cdot x\right) \]
      11. distribute-neg-in94.0%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, \color{blue}{\left(-\left(-t\right)\right) + \left(-z \cdot z\right)}, x \cdot x\right) \]
      12. remove-double-neg94.0%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, \color{blue}{t} + \left(-z \cdot z\right), x \cdot x\right) \]
      13. sub-neg94.0%

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

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

    if 1.2499999999999999e158 < z

    1. Initial program 70.7%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. fma-neg74.5%

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

        \[\leadsto \mathsf{fma}\left(x, x, -\color{blue}{\left(z \cdot z - t\right) \cdot \left(y \cdot 4\right)}\right) \]
      3. distribute-rgt-neg-in74.5%

        \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\left(z \cdot z - t\right) \cdot \left(-y \cdot 4\right)}\right) \]
      4. distribute-rgt-neg-in74.5%

        \[\leadsto \mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \color{blue}{\left(y \cdot \left(-4\right)\right)}\right) \]
      5. metadata-eval74.5%

        \[\leadsto \mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot \color{blue}{-4}\right)\right) \]
      6. add-cube-cbrt74.5%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)}} \]
      7. pow374.5%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)}\right)}^{3}} \]
    4. Applied egg-rr74.5%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(x, x, y \cdot \left(-4 \cdot \left({z}^{2} - t\right)\right)\right)}\right)}^{3}} \]
    5. Taylor expanded in z around inf 53.8%

      \[\leadsto {\color{blue}{\left(z \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{1}{{y}^{2} \cdot {z}^{7}}} \cdot \frac{4 \cdot \left(t \cdot y\right) + {x}^{2}}{{\left(\sqrt[3]{-4}\right)}^{2}}\right) + \sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{-4}\right)\right)}}^{3} \]
    6. Taylor expanded in y around inf 65.9%

      \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \color{blue}{\left(4 \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot \sqrt[3]{\frac{y}{{z}^{7}}}\right)\right)} + \sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
    7. Step-by-step derivation
      1. *-commutative65.9%

        \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \color{blue}{\left(\left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot \sqrt[3]{\frac{y}{{z}^{7}}}\right) \cdot 4\right)} + \sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
      2. *-commutative65.9%

        \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \left(\color{blue}{\left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}}\right)} \cdot 4\right) + \sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
      3. associate-*l*65.9%

        \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \color{blue}{\left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot 4\right)\right)} + \sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
    8. Simplified65.9%

      \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \color{blue}{\left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot 4\right)\right)} + \sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
    9. Step-by-step derivation
      1. cbrt-div92.0%

        \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot 4\right)\right) + \color{blue}{\frac{\sqrt[3]{y}}{\sqrt[3]{z}}} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
    10. Applied egg-rr92.0%

      \[\leadsto {\left(z \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z}^{7}}} \cdot \left(\frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}} \cdot 4\right)\right) + \color{blue}{\frac{\sqrt[3]{y}}{\sqrt[3]{z}}} \cdot \sqrt[3]{-4}\right)\right)}^{3} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.8%

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

Alternative 3: 94.6% accurate, 0.1× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} t_1 := x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z\_m \cdot z\_m\right)\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z\_m \cdot 2\right) \cdot \frac{z\_m \cdot 2}{t}\right)\right)\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;{x}^{2}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (let* ((t_1 (+ (* x x) (* (* y 4.0) (- t (* z_m z_m))))))
   (if (<= t_1 (- INFINITY))
     (- (* x x) (* t (* y (+ -4.0 (* (* z_m 2.0) (/ (* z_m 2.0) t))))))
     (if (<= t_1 INFINITY) t_1 (pow x 2.0)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double t_1 = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = pow(x, 2.0);
	}
	return tmp;
}
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
	double t_1 = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = Math.pow(x, 2.0);
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	t_1 = (x * x) + ((y * 4.0) * (t - (z_m * z_m)))
	tmp = 0
	if t_1 <= -math.inf:
		tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))))
	elif t_1 <= math.inf:
		tmp = t_1
	else:
		tmp = math.pow(x, 2.0)
	return tmp
z_m = abs(z)
function code(x, y, z_m, t)
	t_1 = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z_m * z_m))))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(Float64(x * x) - Float64(t * Float64(y * Float64(-4.0 + Float64(Float64(z_m * 2.0) * Float64(Float64(z_m * 2.0) / t))))));
	elseif (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = x ^ 2.0;
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m, t)
	t_1 = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
	elseif (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = x ^ 2.0;
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * N[(-4.0 + N[(N[(z$95$m * 2.0), $MachinePrecision] * N[(N[(z$95$m * 2.0), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$1, N[Power[x, 2.0], $MachinePrecision]]]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
t_1 := x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z\_m \cdot z\_m\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z\_m \cdot 2\right) \cdot \frac{z\_m \cdot 2}{t}\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) < -inf.0

    1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(\color{blue}{z} \cdot \sqrt{4}\right) \cdot \frac{\sqrt{4 \cdot {z}^{2}}}{t}\right)\right) \]
      8. metadata-eval48.2%

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

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z \cdot 2\right) \cdot \frac{\sqrt{\color{blue}{{z}^{2} \cdot 4}}}{t}\right)\right) \]
      10. sqrt-prod48.2%

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

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z \cdot 2\right) \cdot \frac{\color{blue}{{z}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{4}}{t}\right)\right) \]
      12. metadata-eval89.3%

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z \cdot 2\right) \cdot \frac{{z}^{\color{blue}{1}} \cdot \sqrt{4}}{t}\right)\right) \]
      13. pow189.3%

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

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

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

    if -inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) < +inf.0

    1. Initial program 96.3%

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

    if +inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)))

    1. Initial program 0.0%

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

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

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

Alternative 4: 92.7% accurate, 0.1× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} t_1 := z\_m \cdot z\_m - t\\ \mathbf{if}\;t\_1 \leq 5 \cdot 10^{+296}:\\ \;\;\;\;\mathsf{fma}\left(x, x, t\_1 \cdot \left(y \cdot -4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z\_m \cdot 2\right) \cdot \frac{z\_m \cdot 2}{t}\right)\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (let* ((t_1 (- (* z_m z_m) t)))
   (if (<= t_1 5e+296)
     (fma x x (* t_1 (* y -4.0)))
     (- (* x x) (* t (* y (+ -4.0 (* (* z_m 2.0) (/ (* z_m 2.0) t)))))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double t_1 = (z_m * z_m) - t;
	double tmp;
	if (t_1 <= 5e+296) {
		tmp = fma(x, x, (t_1 * (y * -4.0)));
	} else {
		tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
	}
	return tmp;
}
z_m = abs(z)
function code(x, y, z_m, t)
	t_1 = Float64(Float64(z_m * z_m) - t)
	tmp = 0.0
	if (t_1 <= 5e+296)
		tmp = fma(x, x, Float64(t_1 * Float64(y * -4.0)));
	else
		tmp = Float64(Float64(x * x) - Float64(t * Float64(y * Float64(-4.0 + Float64(Float64(z_m * 2.0) * Float64(Float64(z_m * 2.0) / t))))));
	end
	return tmp
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := Block[{t$95$1 = N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+296], N[(x * x + N[(t$95$1 * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * N[(-4.0 + N[(N[(z$95$m * 2.0), $MachinePrecision] * N[(N[(z$95$m * 2.0), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
t_1 := z\_m \cdot z\_m - t\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+296}:\\
\;\;\;\;\mathsf{fma}\left(x, x, t\_1 \cdot \left(y \cdot -4\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 z z) t) < 5.0000000000000001e296

    1. Initial program 95.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Step-by-step derivation
      1. fma-neg97.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, -\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)} \]
      2. distribute-lft-neg-in97.4%

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

        \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\left(z \cdot z - t\right) \cdot \left(-y \cdot 4\right)}\right) \]
      4. distribute-rgt-neg-in97.4%

        \[\leadsto \mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \color{blue}{\left(y \cdot \left(-4\right)\right)}\right) \]
      5. metadata-eval97.4%

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

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

    if 5.0000000000000001e296 < (-.f64 (*.f64 z z) t)

    1. Initial program 69.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left({z}^{\color{blue}{1}} \cdot \sqrt{4}\right) \cdot \frac{\sqrt{4 \cdot {z}^{2}}}{t}\right)\right) \]
      7. pow136.6%

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(\color{blue}{z} \cdot \sqrt{4}\right) \cdot \frac{\sqrt{4 \cdot {z}^{2}}}{t}\right)\right) \]
      8. metadata-eval36.6%

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z \cdot \color{blue}{2}\right) \cdot \frac{\sqrt{4 \cdot {z}^{2}}}{t}\right)\right) \]
      9. *-commutative36.6%

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

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

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z \cdot 2\right) \cdot \frac{\color{blue}{{z}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{4}}{t}\right)\right) \]
      12. metadata-eval80.5%

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z \cdot 2\right) \cdot \frac{{z}^{\color{blue}{1}} \cdot \sqrt{4}}{t}\right)\right) \]
      13. pow180.5%

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

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

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

Alternative 5: 93.8% accurate, 0.1× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z\_m \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z\_m \cdot z\_m, x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z\_m \cdot 2\right) \cdot \frac{z\_m \cdot 2}{t}\right)\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (if (<= z_m 1.35e+154)
   (fma (* y 4.0) (- t (* z_m z_m)) (* x x))
   (- (* x x) (* t (* y (+ -4.0 (* (* z_m 2.0) (/ (* z_m 2.0) t))))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if (z_m <= 1.35e+154) {
		tmp = fma((y * 4.0), (t - (z_m * z_m)), (x * x));
	} else {
		tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
	}
	return tmp;
}
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (z_m <= 1.35e+154)
		tmp = fma(Float64(y * 4.0), Float64(t - Float64(z_m * z_m)), Float64(x * x));
	else
		tmp = Float64(Float64(x * x) - Float64(t * Float64(y * Float64(-4.0 + Float64(Float64(z_m * 2.0) * Float64(Float64(z_m * 2.0) / t))))));
	end
	return tmp
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 1.35e+154], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * N[(-4.0 + N[(N[(z$95$m * 2.0), $MachinePrecision] * N[(N[(z$95$m * 2.0), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z\_m \cdot z\_m, x \cdot x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.35000000000000003e154

    1. Initial program 91.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv91.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot 4\right) \cdot \left(-\left(z \cdot z - t\right)\right)} + x \cdot x \]
      8. fma-define94.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot 4, -\left(z \cdot z - t\right), x \cdot x\right)} \]
      9. sub-neg94.0%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, -\color{blue}{\left(z \cdot z + \left(-t\right)\right)}, x \cdot x\right) \]
      10. +-commutative94.0%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, -\color{blue}{\left(\left(-t\right) + z \cdot z\right)}, x \cdot x\right) \]
      11. distribute-neg-in94.0%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, \color{blue}{\left(-\left(-t\right)\right) + \left(-z \cdot z\right)}, x \cdot x\right) \]
      12. remove-double-neg94.0%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, \color{blue}{t} + \left(-z \cdot z\right), x \cdot x\right) \]
      13. sub-neg94.0%

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

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

    if 1.35000000000000003e154 < z

    1. Initial program 70.7%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot x - t \cdot \left(y \cdot -4 + \color{blue}{y \cdot \frac{4 \cdot {z}^{2}}{t}}\right) \]
      8. distribute-lft-out70.7%

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

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

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

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \color{blue}{\sqrt{4 \cdot {z}^{2}} \cdot \frac{\sqrt{4 \cdot {z}^{2}}}{t}}\right)\right) \]
      3. *-commutative70.7%

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

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

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(\color{blue}{{z}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{4}\right) \cdot \frac{\sqrt{4 \cdot {z}^{2}}}{t}\right)\right) \]
      6. metadata-eval70.7%

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

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(\color{blue}{z} \cdot \sqrt{4}\right) \cdot \frac{\sqrt{4 \cdot {z}^{2}}}{t}\right)\right) \]
      8. metadata-eval70.7%

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z \cdot \color{blue}{2}\right) \cdot \frac{\sqrt{4 \cdot {z}^{2}}}{t}\right)\right) \]
      9. *-commutative70.7%

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

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

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z \cdot 2\right) \cdot \frac{\color{blue}{{z}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{4}}{t}\right)\right) \]
      12. metadata-eval78.0%

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z \cdot 2\right) \cdot \frac{{z}^{\color{blue}{1}} \cdot \sqrt{4}}{t}\right)\right) \]
      13. pow178.0%

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

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

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

Alternative 6: 92.3% accurate, 0.5× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z\_m \cdot z\_m \leq 5 \cdot 10^{+296}:\\ \;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z\_m \cdot z\_m\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z\_m \cdot 2\right) \cdot \frac{z\_m \cdot 2}{t}\right)\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (if (<= (* z_m z_m) 5e+296)
   (+ (* x x) (* (* y 4.0) (- t (* z_m z_m))))
   (- (* x x) (* t (* y (+ -4.0 (* (* z_m 2.0) (/ (* z_m 2.0) t))))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if ((z_m * z_m) <= 5e+296) {
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	} else {
		tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
	}
	return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((z_m * z_m) <= 5d+296) then
        tmp = (x * x) + ((y * 4.0d0) * (t - (z_m * z_m)))
    else
        tmp = (x * x) - (t * (y * ((-4.0d0) + ((z_m * 2.0d0) * ((z_m * 2.0d0) / t)))))
    end if
    code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
	double tmp;
	if ((z_m * z_m) <= 5e+296) {
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	} else {
		tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	tmp = 0
	if (z_m * z_m) <= 5e+296:
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)))
	else:
		tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))))
	return tmp
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (Float64(z_m * z_m) <= 5e+296)
		tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z_m * z_m))));
	else
		tmp = Float64(Float64(x * x) - Float64(t * Float64(y * Float64(-4.0 + Float64(Float64(z_m * 2.0) * Float64(Float64(z_m * 2.0) / t))))));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m, t)
	tmp = 0.0;
	if ((z_m * z_m) <= 5e+296)
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	else
		tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 5e+296], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * N[(-4.0 + N[(N[(z$95$m * 2.0), $MachinePrecision] * N[(N[(z$95$m * 2.0), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 5 \cdot 10^{+296}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z\_m \cdot z\_m\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z z) < 5.0000000000000001e296

    1. Initial program 95.9%

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

    if 5.0000000000000001e296 < (*.f64 z z)

    1. Initial program 68.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(\color{blue}{z} \cdot \sqrt{4}\right) \cdot \frac{\sqrt{4 \cdot {z}^{2}}}{t}\right)\right) \]
      8. metadata-eval34.4%

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

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z \cdot 2\right) \cdot \frac{\sqrt{\color{blue}{{z}^{2} \cdot 4}}}{t}\right)\right) \]
      10. sqrt-prod34.4%

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

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z \cdot 2\right) \cdot \frac{\color{blue}{{z}^{\left(\frac{2}{2}\right)}} \cdot \sqrt{4}}{t}\right)\right) \]
      12. metadata-eval79.9%

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z \cdot 2\right) \cdot \frac{{z}^{\color{blue}{1}} \cdot \sqrt{4}}{t}\right)\right) \]
      13. pow179.9%

        \[\leadsto x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z \cdot 2\right) \cdot \frac{\color{blue}{z} \cdot \sqrt{4}}{t}\right)\right) \]
      14. metadata-eval79.9%

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

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

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

Alternative 7: 92.6% accurate, 0.6× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 8.8 \cdot 10^{+296}:\\ \;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z\_m \cdot z\_m\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (if (<= (* x x) 8.8e+296)
   (+ (* x x) (* (* y 4.0) (- t (* z_m z_m))))
   (- (* x x) (* y (* t -4.0)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if ((x * x) <= 8.8e+296) {
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	} else {
		tmp = (x * x) - (y * (t * -4.0));
	}
	return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((x * x) <= 8.8d+296) then
        tmp = (x * x) + ((y * 4.0d0) * (t - (z_m * z_m)))
    else
        tmp = (x * x) - (y * (t * (-4.0d0)))
    end if
    code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
	double tmp;
	if ((x * x) <= 8.8e+296) {
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	} else {
		tmp = (x * x) - (y * (t * -4.0));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	tmp = 0
	if (x * x) <= 8.8e+296:
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)))
	else:
		tmp = (x * x) - (y * (t * -4.0))
	return tmp
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (Float64(x * x) <= 8.8e+296)
		tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z_m * z_m))));
	else
		tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0)));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m, t)
	tmp = 0.0;
	if ((x * x) <= 8.8e+296)
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	else
		tmp = (x * x) - (y * (t * -4.0));
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 8.8e+296], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 8.8 \cdot 10^{+296}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z\_m \cdot z\_m\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 8.80000000000000056e296

    1. Initial program 91.8%

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

    if 8.80000000000000056e296 < (*.f64 x x)

    1. Initial program 84.3%

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

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

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

        \[\leadsto x \cdot x - \color{blue}{\left(y \cdot t\right)} \cdot -4 \]
      3. associate-*l*91.6%

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

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

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

Alternative 8: 67.4% accurate, 1.4× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ x \cdot x - y \cdot \left(t \cdot -4\right) \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t) :precision binary64 (- (* x x) (* y (* t -4.0))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	return (x * x) - (y * (t * -4.0));
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    code = (x * x) - (y * (t * (-4.0d0)))
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
	return (x * x) - (y * (t * -4.0));
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	return (x * x) - (y * (t * -4.0))
z_m = abs(z)
function code(x, y, z_m, t)
	return Float64(Float64(x * x) - Float64(y * Float64(t * -4.0)))
end
z_m = abs(z);
function tmp = code(x, y, z_m, t)
	tmp = (x * x) - (y * (t * -4.0));
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|

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

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

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

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

      \[\leadsto x \cdot x - \color{blue}{\left(y \cdot t\right)} \cdot -4 \]
    3. associate-*l*66.0%

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

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

Alternative 9: 32.2% accurate, 2.6× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ 4 \cdot \left(y \cdot t\right) \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t) :precision binary64 (* 4.0 (* y t)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	return 4.0 * (y * t);
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    code = 4.0d0 * (y * t)
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
	return 4.0 * (y * t);
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	return 4.0 * (y * t)
z_m = abs(z)
function code(x, y, z_m, t)
	return Float64(4.0 * Float64(y * t))
end
z_m = abs(z);
function tmp = code(x, y, z_m, t)
	tmp = 4.0 * (y * t);
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|

\\
4 \cdot \left(y \cdot t\right)
\end{array}
Derivation
  1. Initial program 89.7%

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

    \[\leadsto \color{blue}{4 \cdot \left(t \cdot y\right)} \]
  4. Step-by-step derivation
    1. *-commutative33.6%

      \[\leadsto 4 \cdot \color{blue}{\left(y \cdot t\right)} \]
  5. Simplified33.6%

    \[\leadsto \color{blue}{4 \cdot \left(y \cdot t\right)} \]
  6. Add Preprocessing

Developer target: 91.0% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2024083 
(FPCore (x y z t)
  :name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
  :precision binary64

  :alt
  (- (* x x) (* 4.0 (* y (- (* z z) t))))

  (- (* x x) (* (* y 4.0) (- (* z z) t))))