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

Percentage Accurate: 91.5% → 96.5%
Time: 9.8s
Alternatives: 8
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 8 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: 91.5% 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.5% accurate, 0.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;z\_m \cdot \left(z\_m \cdot \left(y \cdot -4\right)\right)\\


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

    1. Initial program 94.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.7999999999999999e149 < z

    1. Initial program 75.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 inf 86.7%

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

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot {z}^{2}} \]
      2. *-commutative86.7%

        \[\leadsto \color{blue}{{z}^{2} \cdot \left(-4 \cdot y\right)} \]
    5. Simplified86.7%

      \[\leadsto \color{blue}{{z}^{2} \cdot \left(-4 \cdot y\right)} \]
    6. Step-by-step derivation
      1. unpow286.7%

        \[\leadsto \color{blue}{\left(z \cdot z\right)} \cdot \left(-4 \cdot y\right) \]
    7. Applied egg-rr86.7%

      \[\leadsto \color{blue}{\left(z \cdot z\right)} \cdot \left(-4 \cdot y\right) \]
    8. Step-by-step derivation
      1. add-sqr-sqrt29.2%

        \[\leadsto \color{blue}{\sqrt{\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)} \cdot \sqrt{\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)}} \]
      2. pow229.2%

        \[\leadsto \color{blue}{{\left(\sqrt{\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)}\right)}^{2}} \]
      3. sqrt-prod29.2%

        \[\leadsto {\color{blue}{\left(\sqrt{z \cdot z} \cdot \sqrt{-4 \cdot y}\right)}}^{2} \]
      4. sqrt-prod34.5%

        \[\leadsto {\left(\color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \cdot \sqrt{-4 \cdot y}\right)}^{2} \]
      5. add-sqr-sqrt34.5%

        \[\leadsto {\left(\color{blue}{z} \cdot \sqrt{-4 \cdot y}\right)}^{2} \]
      6. *-commutative34.5%

        \[\leadsto {\left(z \cdot \sqrt{\color{blue}{y \cdot -4}}\right)}^{2} \]
    9. Applied egg-rr34.5%

      \[\leadsto \color{blue}{{\left(z \cdot \sqrt{y \cdot -4}\right)}^{2}} \]
    10. Step-by-step derivation
      1. *-commutative34.5%

        \[\leadsto {\color{blue}{\left(\sqrt{y \cdot -4} \cdot z\right)}}^{2} \]
      2. unpow-prod-down29.2%

        \[\leadsto \color{blue}{{\left(\sqrt{y \cdot -4}\right)}^{2} \cdot {z}^{2}} \]
      3. pow229.2%

        \[\leadsto \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)} \cdot {z}^{2} \]
      4. add-sqr-sqrt86.7%

        \[\leadsto \color{blue}{\left(y \cdot -4\right)} \cdot {z}^{2} \]
      5. *-commutative86.7%

        \[\leadsto \color{blue}{\left(-4 \cdot y\right)} \cdot {z}^{2} \]
      6. pow286.7%

        \[\leadsto \left(-4 \cdot y\right) \cdot \color{blue}{\left(z \cdot z\right)} \]
      7. associate-*r*94.5%

        \[\leadsto \color{blue}{\left(\left(-4 \cdot y\right) \cdot z\right) \cdot z} \]
    11. Applied egg-rr94.5%

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

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

Alternative 2: 93.6% accurate, 0.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.04999999999999999e170

    1. Initial program 93.2%

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

        \[\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-in94.9%

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

        \[\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-in94.9%

        \[\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-eval94.9%

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

      \[\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 1.04999999999999999e170 < x

    1. Initial program 80.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 93.3%

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

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

Alternative 3: 95.7% accurate, 0.6× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z\_m \cdot z\_m \leq 2 \cdot 10^{+298}:\\ \;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z\_m \cdot z\_m\right)\\ \mathbf{else}:\\ \;\;\;\;z\_m \cdot \left(z\_m \cdot \left(y \cdot -4\right)\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (if (<= (* z_m z_m) 2e+298)
   (+ (* x x) (* (* y 4.0) (- t (* z_m z_m))))
   (* z_m (* z_m (* y -4.0)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if ((z_m * z_m) <= 2e+298) {
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	} else {
		tmp = z_m * (z_m * (y * -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 ((z_m * z_m) <= 2d+298) then
        tmp = (x * x) + ((y * 4.0d0) * (t - (z_m * z_m)))
    else
        tmp = z_m * (z_m * (y * (-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 ((z_m * z_m) <= 2e+298) {
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	} else {
		tmp = z_m * (z_m * (y * -4.0));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	tmp = 0
	if (z_m * z_m) <= 2e+298:
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)))
	else:
		tmp = z_m * (z_m * (y * -4.0))
	return tmp
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (Float64(z_m * z_m) <= 2e+298)
		tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z_m * z_m))));
	else
		tmp = Float64(z_m * Float64(z_m * Float64(y * -4.0)));
	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) <= 2e+298)
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	else
		tmp = z_m * (z_m * (y * -4.0));
	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], 2e+298], 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[(z$95$m * N[(z$95$m * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

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

\mathbf{else}:\\
\;\;\;\;z\_m \cdot \left(z\_m \cdot \left(y \cdot -4\right)\right)\\


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

    1. Initial program 96.8%

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

    if 1.9999999999999999e298 < (*.f64 z z)

    1. Initial program 76.0%

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

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

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot {z}^{2}} \]
      2. *-commutative85.4%

        \[\leadsto \color{blue}{{z}^{2} \cdot \left(-4 \cdot y\right)} \]
    5. Simplified85.4%

      \[\leadsto \color{blue}{{z}^{2} \cdot \left(-4 \cdot y\right)} \]
    6. Step-by-step derivation
      1. unpow285.4%

        \[\leadsto \color{blue}{\left(z \cdot z\right)} \cdot \left(-4 \cdot y\right) \]
    7. Applied egg-rr85.4%

      \[\leadsto \color{blue}{\left(z \cdot z\right)} \cdot \left(-4 \cdot y\right) \]
    8. Step-by-step derivation
      1. add-sqr-sqrt42.8%

        \[\leadsto \color{blue}{\sqrt{\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)} \cdot \sqrt{\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)}} \]
      2. pow242.8%

        \[\leadsto \color{blue}{{\left(\sqrt{\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)}\right)}^{2}} \]
      3. sqrt-prod42.8%

        \[\leadsto {\color{blue}{\left(\sqrt{z \cdot z} \cdot \sqrt{-4 \cdot y}\right)}}^{2} \]
      4. sqrt-prod18.9%

        \[\leadsto {\left(\color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \cdot \sqrt{-4 \cdot y}\right)}^{2} \]
      5. add-sqr-sqrt47.0%

        \[\leadsto {\left(\color{blue}{z} \cdot \sqrt{-4 \cdot y}\right)}^{2} \]
      6. *-commutative47.0%

        \[\leadsto {\left(z \cdot \sqrt{\color{blue}{y \cdot -4}}\right)}^{2} \]
    9. Applied egg-rr47.0%

      \[\leadsto \color{blue}{{\left(z \cdot \sqrt{y \cdot -4}\right)}^{2}} \]
    10. Step-by-step derivation
      1. *-commutative47.0%

        \[\leadsto {\color{blue}{\left(\sqrt{y \cdot -4} \cdot z\right)}}^{2} \]
      2. unpow-prod-down42.8%

        \[\leadsto \color{blue}{{\left(\sqrt{y \cdot -4}\right)}^{2} \cdot {z}^{2}} \]
      3. pow242.8%

        \[\leadsto \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)} \cdot {z}^{2} \]
      4. add-sqr-sqrt85.4%

        \[\leadsto \color{blue}{\left(y \cdot -4\right)} \cdot {z}^{2} \]
      5. *-commutative85.4%

        \[\leadsto \color{blue}{\left(-4 \cdot y\right)} \cdot {z}^{2} \]
      6. pow285.4%

        \[\leadsto \left(-4 \cdot y\right) \cdot \color{blue}{\left(z \cdot z\right)} \]
      7. associate-*r*93.9%

        \[\leadsto \color{blue}{\left(\left(-4 \cdot y\right) \cdot z\right) \cdot z} \]
    11. Applied egg-rr93.9%

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

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

Alternative 4: 84.7% accurate, 0.8× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z\_m \cdot z\_m \leq 2 \cdot 10^{+231}:\\ \;\;\;\;x \cdot x - -4 \cdot \left(y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;z\_m \cdot \left(z\_m \cdot \left(y \cdot -4\right)\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (if (<= (* z_m z_m) 2e+231)
   (- (* x x) (* -4.0 (* y t)))
   (* z_m (* z_m (* y -4.0)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if ((z_m * z_m) <= 2e+231) {
		tmp = (x * x) - (-4.0 * (y * t));
	} else {
		tmp = z_m * (z_m * (y * -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 ((z_m * z_m) <= 2d+231) then
        tmp = (x * x) - ((-4.0d0) * (y * t))
    else
        tmp = z_m * (z_m * (y * (-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 ((z_m * z_m) <= 2e+231) {
		tmp = (x * x) - (-4.0 * (y * t));
	} else {
		tmp = z_m * (z_m * (y * -4.0));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	tmp = 0
	if (z_m * z_m) <= 2e+231:
		tmp = (x * x) - (-4.0 * (y * t))
	else:
		tmp = z_m * (z_m * (y * -4.0))
	return tmp
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (Float64(z_m * z_m) <= 2e+231)
		tmp = Float64(Float64(x * x) - Float64(-4.0 * Float64(y * t)));
	else
		tmp = Float64(z_m * Float64(z_m * Float64(y * -4.0)));
	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) <= 2e+231)
		tmp = (x * x) - (-4.0 * (y * t));
	else
		tmp = z_m * (z_m * (y * -4.0));
	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], 2e+231], N[(N[(x * x), $MachinePrecision] - N[(-4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z$95$m * N[(z$95$m * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

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

\mathbf{else}:\\
\;\;\;\;z\_m \cdot \left(z\_m \cdot \left(y \cdot -4\right)\right)\\


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

    1. Initial program 96.6%

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

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

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

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

    if 2.0000000000000001e231 < (*.f64 z z)

    1. Initial program 79.8%

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

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

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot {z}^{2}} \]
      2. *-commutative83.9%

        \[\leadsto \color{blue}{{z}^{2} \cdot \left(-4 \cdot y\right)} \]
    5. Simplified83.9%

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

        \[\leadsto \color{blue}{\left(z \cdot z\right)} \cdot \left(-4 \cdot y\right) \]
    7. Applied egg-rr83.9%

      \[\leadsto \color{blue}{\left(z \cdot z\right)} \cdot \left(-4 \cdot y\right) \]
    8. Step-by-step derivation
      1. add-sqr-sqrt37.4%

        \[\leadsto \color{blue}{\sqrt{\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)} \cdot \sqrt{\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)}} \]
      2. pow237.4%

        \[\leadsto \color{blue}{{\left(\sqrt{\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)}\right)}^{2}} \]
      3. sqrt-prod37.4%

        \[\leadsto {\color{blue}{\left(\sqrt{z \cdot z} \cdot \sqrt{-4 \cdot y}\right)}}^{2} \]
      4. sqrt-prod15.9%

        \[\leadsto {\left(\color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \cdot \sqrt{-4 \cdot y}\right)}^{2} \]
      5. add-sqr-sqrt41.0%

        \[\leadsto {\left(\color{blue}{z} \cdot \sqrt{-4 \cdot y}\right)}^{2} \]
      6. *-commutative41.0%

        \[\leadsto {\left(z \cdot \sqrt{\color{blue}{y \cdot -4}}\right)}^{2} \]
    9. Applied egg-rr41.0%

      \[\leadsto \color{blue}{{\left(z \cdot \sqrt{y \cdot -4}\right)}^{2}} \]
    10. Step-by-step derivation
      1. *-commutative41.0%

        \[\leadsto {\color{blue}{\left(\sqrt{y \cdot -4} \cdot z\right)}}^{2} \]
      2. unpow-prod-down37.4%

        \[\leadsto \color{blue}{{\left(\sqrt{y \cdot -4}\right)}^{2} \cdot {z}^{2}} \]
      3. pow237.4%

        \[\leadsto \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)} \cdot {z}^{2} \]
      4. add-sqr-sqrt83.9%

        \[\leadsto \color{blue}{\left(y \cdot -4\right)} \cdot {z}^{2} \]
      5. *-commutative83.9%

        \[\leadsto \color{blue}{\left(-4 \cdot y\right)} \cdot {z}^{2} \]
      6. pow283.9%

        \[\leadsto \left(-4 \cdot y\right) \cdot \color{blue}{\left(z \cdot z\right)} \]
      7. associate-*r*90.9%

        \[\leadsto \color{blue}{\left(\left(-4 \cdot y\right) \cdot z\right) \cdot z} \]
    11. Applied egg-rr90.9%

      \[\leadsto \color{blue}{\left(\left(-4 \cdot y\right) \cdot z\right) \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.6%

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

Alternative 5: 55.9% accurate, 0.9× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z\_m \cdot z\_m \leq 8.5 \cdot 10^{+76}:\\ \;\;\;\;\left(y \cdot 4\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(z\_m \cdot z\_m\right) \cdot \left(y \cdot -4\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (if (<= (* z_m z_m) 8.5e+76) (* (* y 4.0) t) (* (* z_m z_m) (* y -4.0))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if ((z_m * z_m) <= 8.5e+76) {
		tmp = (y * 4.0) * t;
	} else {
		tmp = (z_m * z_m) * (y * -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 ((z_m * z_m) <= 8.5d+76) then
        tmp = (y * 4.0d0) * t
    else
        tmp = (z_m * z_m) * (y * (-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 ((z_m * z_m) <= 8.5e+76) {
		tmp = (y * 4.0) * t;
	} else {
		tmp = (z_m * z_m) * (y * -4.0);
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	tmp = 0
	if (z_m * z_m) <= 8.5e+76:
		tmp = (y * 4.0) * t
	else:
		tmp = (z_m * z_m) * (y * -4.0)
	return tmp
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (Float64(z_m * z_m) <= 8.5e+76)
		tmp = Float64(Float64(y * 4.0) * t);
	else
		tmp = Float64(Float64(z_m * z_m) * Float64(y * -4.0));
	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) <= 8.5e+76)
		tmp = (y * 4.0) * t;
	else
		tmp = (z_m * z_m) * (y * -4.0);
	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], 8.5e+76], N[(N[(y * 4.0), $MachinePrecision] * t), $MachinePrecision], N[(N[(z$95$m * z$95$m), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

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

\mathbf{else}:\\
\;\;\;\;\left(z\_m \cdot z\_m\right) \cdot \left(y \cdot -4\right)\\


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

    1. Initial program 97.9%

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

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

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

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

      \[\leadsto \color{blue}{\left(y \cdot t\right) \cdot 4} \]
    6. Taylor expanded in y around 0 51.1%

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

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

        \[\leadsto \color{blue}{\left(y \cdot t\right) \cdot 4} \]
      3. *-commutative51.1%

        \[\leadsto \color{blue}{\left(t \cdot y\right)} \cdot 4 \]
      4. associate-*r*51.1%

        \[\leadsto \color{blue}{t \cdot \left(y \cdot 4\right)} \]
    8. Simplified51.1%

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

    if 8.49999999999999992e76 < (*.f64 z z)

    1. Initial program 83.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 inf 71.1%

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

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot {z}^{2}} \]
      2. *-commutative71.1%

        \[\leadsto \color{blue}{{z}^{2} \cdot \left(-4 \cdot y\right)} \]
    5. Simplified71.1%

      \[\leadsto \color{blue}{{z}^{2} \cdot \left(-4 \cdot y\right)} \]
    6. Step-by-step derivation
      1. unpow271.1%

        \[\leadsto \color{blue}{\left(z \cdot z\right)} \cdot \left(-4 \cdot y\right) \]
    7. Applied egg-rr71.1%

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

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

Alternative 6: 58.9% accurate, 0.9× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z\_m \cdot z\_m \leq 4 \cdot 10^{+61}:\\ \;\;\;\;\left(y \cdot 4\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;z\_m \cdot \left(z\_m \cdot \left(y \cdot -4\right)\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (if (<= (* z_m z_m) 4e+61) (* (* y 4.0) t) (* z_m (* z_m (* y -4.0)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if ((z_m * z_m) <= 4e+61) {
		tmp = (y * 4.0) * t;
	} else {
		tmp = z_m * (z_m * (y * -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 ((z_m * z_m) <= 4d+61) then
        tmp = (y * 4.0d0) * t
    else
        tmp = z_m * (z_m * (y * (-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 ((z_m * z_m) <= 4e+61) {
		tmp = (y * 4.0) * t;
	} else {
		tmp = z_m * (z_m * (y * -4.0));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	tmp = 0
	if (z_m * z_m) <= 4e+61:
		tmp = (y * 4.0) * t
	else:
		tmp = z_m * (z_m * (y * -4.0))
	return tmp
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (Float64(z_m * z_m) <= 4e+61)
		tmp = Float64(Float64(y * 4.0) * t);
	else
		tmp = Float64(z_m * Float64(z_m * Float64(y * -4.0)));
	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) <= 4e+61)
		tmp = (y * 4.0) * t;
	else
		tmp = z_m * (z_m * (y * -4.0));
	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], 4e+61], N[(N[(y * 4.0), $MachinePrecision] * t), $MachinePrecision], N[(z$95$m * N[(z$95$m * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

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

\mathbf{else}:\\
\;\;\;\;z\_m \cdot \left(z\_m \cdot \left(y \cdot -4\right)\right)\\


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

    1. Initial program 97.9%

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

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

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

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

      \[\leadsto \color{blue}{\left(y \cdot t\right) \cdot 4} \]
    6. Taylor expanded in y around 0 51.1%

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

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

        \[\leadsto \color{blue}{\left(y \cdot t\right) \cdot 4} \]
      3. *-commutative51.1%

        \[\leadsto \color{blue}{\left(t \cdot y\right)} \cdot 4 \]
      4. associate-*r*51.1%

        \[\leadsto \color{blue}{t \cdot \left(y \cdot 4\right)} \]
    8. Simplified51.1%

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

    if 3.9999999999999998e61 < (*.f64 z z)

    1. Initial program 83.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 inf 71.1%

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

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot {z}^{2}} \]
      2. *-commutative71.1%

        \[\leadsto \color{blue}{{z}^{2} \cdot \left(-4 \cdot y\right)} \]
    5. Simplified71.1%

      \[\leadsto \color{blue}{{z}^{2} \cdot \left(-4 \cdot y\right)} \]
    6. Step-by-step derivation
      1. unpow271.1%

        \[\leadsto \color{blue}{\left(z \cdot z\right)} \cdot \left(-4 \cdot y\right) \]
    7. Applied egg-rr71.1%

      \[\leadsto \color{blue}{\left(z \cdot z\right)} \cdot \left(-4 \cdot y\right) \]
    8. Step-by-step derivation
      1. add-sqr-sqrt32.6%

        \[\leadsto \color{blue}{\sqrt{\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)} \cdot \sqrt{\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)}} \]
      2. pow232.6%

        \[\leadsto \color{blue}{{\left(\sqrt{\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)}\right)}^{2}} \]
      3. sqrt-prod32.6%

        \[\leadsto {\color{blue}{\left(\sqrt{z \cdot z} \cdot \sqrt{-4 \cdot y}\right)}}^{2} \]
      4. sqrt-prod14.7%

        \[\leadsto {\left(\color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \cdot \sqrt{-4 \cdot y}\right)}^{2} \]
      5. add-sqr-sqrt35.1%

        \[\leadsto {\left(\color{blue}{z} \cdot \sqrt{-4 \cdot y}\right)}^{2} \]
      6. *-commutative35.1%

        \[\leadsto {\left(z \cdot \sqrt{\color{blue}{y \cdot -4}}\right)}^{2} \]
    9. Applied egg-rr35.1%

      \[\leadsto \color{blue}{{\left(z \cdot \sqrt{y \cdot -4}\right)}^{2}} \]
    10. Step-by-step derivation
      1. *-commutative35.1%

        \[\leadsto {\color{blue}{\left(\sqrt{y \cdot -4} \cdot z\right)}}^{2} \]
      2. unpow-prod-down32.6%

        \[\leadsto \color{blue}{{\left(\sqrt{y \cdot -4}\right)}^{2} \cdot {z}^{2}} \]
      3. pow232.6%

        \[\leadsto \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)} \cdot {z}^{2} \]
      4. add-sqr-sqrt71.1%

        \[\leadsto \color{blue}{\left(y \cdot -4\right)} \cdot {z}^{2} \]
      5. *-commutative71.1%

        \[\leadsto \color{blue}{\left(-4 \cdot y\right)} \cdot {z}^{2} \]
      6. pow271.1%

        \[\leadsto \left(-4 \cdot y\right) \cdot \color{blue}{\left(z \cdot z\right)} \]
      7. associate-*r*76.0%

        \[\leadsto \color{blue}{\left(\left(-4 \cdot y\right) \cdot z\right) \cdot z} \]
    11. Applied egg-rr76.0%

      \[\leadsto \color{blue}{\left(\left(-4 \cdot y\right) \cdot z\right) \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.8%

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

Alternative 7: 32.1% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 94.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 38.5%

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

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

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

      \[\leadsto \color{blue}{\left(y \cdot t\right) \cdot 4} \]
    6. Taylor expanded in y around 0 38.5%

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

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

        \[\leadsto \color{blue}{\left(y \cdot t\right) \cdot 4} \]
      3. *-commutative38.5%

        \[\leadsto \color{blue}{\left(t \cdot y\right)} \cdot 4 \]
      4. associate-*r*38.9%

        \[\leadsto \color{blue}{t \cdot \left(y \cdot 4\right)} \]
    8. Simplified38.9%

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

    if 3.6e151 < z

    1. Initial program 74.6%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot x - \sqrt{\left(y \cdot -4\right) \cdot \color{blue}{\left(y \cdot -4\right)}} \cdot t \]
      6. swap-sqr36.0%

        \[\leadsto x \cdot x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot \left(-4 \cdot -4\right)}} \cdot t \]
      7. metadata-eval36.0%

        \[\leadsto x \cdot x - \sqrt{\left(y \cdot y\right) \cdot \color{blue}{16}} \cdot t \]
      8. metadata-eval36.0%

        \[\leadsto x \cdot x - \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(4 \cdot 4\right)}} \cdot t \]
      9. swap-sqr36.0%

        \[\leadsto x \cdot x - \sqrt{\color{blue}{\left(y \cdot 4\right) \cdot \left(y \cdot 4\right)}} \cdot t \]
      10. sqrt-unprod15.2%

        \[\leadsto x \cdot x - \color{blue}{\left(\sqrt{y \cdot 4} \cdot \sqrt{y \cdot 4}\right)} \cdot t \]
      11. add-sqr-sqrt30.4%

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

        \[\leadsto x \cdot x - \color{blue}{\left(4 \cdot y\right)} \cdot t \]
      13. associate-*r*30.4%

        \[\leadsto x \cdot x - \color{blue}{4 \cdot \left(y \cdot t\right)} \]
      14. metadata-eval30.4%

        \[\leadsto x \cdot x - \color{blue}{\left(--4\right)} \cdot \left(y \cdot t\right) \]
      15. distribute-lft-neg-in30.4%

        \[\leadsto x \cdot x - \color{blue}{\left(--4 \cdot \left(y \cdot t\right)\right)} \]
      16. associate-*r*30.4%

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

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

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

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

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

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

Alternative 8: 5.9% 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 91.6%

    \[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.8%

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

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

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

      \[\leadsto x \cdot x - \color{blue}{\left(-4 \cdot y\right) \cdot t} \]
    2. add-sqr-sqrt34.9%

      \[\leadsto x \cdot x - \color{blue}{\left(\sqrt{-4 \cdot y} \cdot \sqrt{-4 \cdot y}\right)} \cdot t \]
    3. sqrt-unprod47.7%

      \[\leadsto x \cdot x - \color{blue}{\sqrt{\left(-4 \cdot y\right) \cdot \left(-4 \cdot y\right)}} \cdot t \]
    4. *-commutative47.7%

      \[\leadsto x \cdot x - \sqrt{\color{blue}{\left(y \cdot -4\right)} \cdot \left(-4 \cdot y\right)} \cdot t \]
    5. *-commutative47.7%

      \[\leadsto x \cdot x - \sqrt{\left(y \cdot -4\right) \cdot \color{blue}{\left(y \cdot -4\right)}} \cdot t \]
    6. swap-sqr47.7%

      \[\leadsto x \cdot x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot \left(-4 \cdot -4\right)}} \cdot t \]
    7. metadata-eval47.7%

      \[\leadsto x \cdot x - \sqrt{\left(y \cdot y\right) \cdot \color{blue}{16}} \cdot t \]
    8. metadata-eval47.7%

      \[\leadsto x \cdot x - \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(4 \cdot 4\right)}} \cdot t \]
    9. swap-sqr47.7%

      \[\leadsto x \cdot x - \sqrt{\color{blue}{\left(y \cdot 4\right) \cdot \left(y \cdot 4\right)}} \cdot t \]
    10. sqrt-unprod20.3%

      \[\leadsto x \cdot x - \color{blue}{\left(\sqrt{y \cdot 4} \cdot \sqrt{y \cdot 4}\right)} \cdot t \]
    11. add-sqr-sqrt40.0%

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

      \[\leadsto x \cdot x - \color{blue}{\left(4 \cdot y\right)} \cdot t \]
    13. associate-*r*40.0%

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

      \[\leadsto x \cdot x - \color{blue}{\left(--4\right)} \cdot \left(y \cdot t\right) \]
    15. distribute-lft-neg-in40.0%

      \[\leadsto x \cdot x - \color{blue}{\left(--4 \cdot \left(y \cdot t\right)\right)} \]
    16. associate-*r*40.0%

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

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

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

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

    \[\leadsto \color{blue}{-4 \cdot \left(t \cdot y\right)} \]
  9. Final simplification7.6%

    \[\leadsto -4 \cdot \left(y \cdot t\right) \]
  10. Add Preprocessing

Developer target: 91.5% 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 2024044 
(FPCore (x y z t)
  :name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
  :precision binary64

  :herbie-target
  (- (* x x) (* 4.0 (* y (- (* z z) t))))

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