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

Percentage Accurate: 90.5% → 95.2%
Time: 14.6s
Alternatives: 7
Speedup: 0.5×

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 7 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 90.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: 95.2% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 96.1%

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

      \[\leadsto x \cdot x - \color{blue}{\left(-4 \cdot \left(t \cdot y\right) + 4 \cdot \left(y \cdot {z}^{2}\right)\right)} \]
    3. Step-by-step derivation
      1. add-cube-cbrt94.9%

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

        \[\leadsto x \cdot x - \left(-4 \cdot \left(t \cdot y\right) + 4 \cdot \color{blue}{{\left(\sqrt[3]{y \cdot {z}^{2}}\right)}^{3}}\right) \]
    4. Applied egg-rr94.9%

      \[\leadsto x \cdot x - \left(-4 \cdot \left(t \cdot y\right) + 4 \cdot \color{blue}{{\left(\sqrt[3]{y \cdot {z}^{2}}\right)}^{3}}\right) \]
    5. Step-by-step derivation
      1. rem-cube-cbrt95.1%

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

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

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

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

    if 5.00000000000000033e264 < (*.f64 x x)

    1. Initial program 77.4%

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

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

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

Alternative 2: 93.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \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 - \left(-4 \cdot \left(t \cdot y\right) + 4 \cdot \left(z \cdot \left(y \cdot z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (+ (* x x) (* (* y 4.0) (- t (* z z)))) INFINITY)
   (- (* x x) (+ (* -4.0 (* t y)) (* 4.0 (* z (* y z)))))
   (* t (* y 4.0))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * x) + ((y * 4.0) * (t - (z * z)))) <= ((double) INFINITY)) {
		tmp = (x * x) - ((-4.0 * (t * y)) + (4.0 * (z * (y * z))));
	} else {
		tmp = t * (y * 4.0);
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * x) + ((y * 4.0) * (t - (z * z)))) <= Double.POSITIVE_INFINITY) {
		tmp = (x * x) - ((-4.0 * (t * y)) + (4.0 * (z * (y * z))));
	} else {
		tmp = t * (y * 4.0);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x * x) + ((y * 4.0) * (t - (z * z)))) <= math.inf:
		tmp = (x * x) - ((-4.0 * (t * y)) + (4.0 * (z * (y * z))))
	else:
		tmp = t * (y * 4.0)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))) <= Inf)
		tmp = Float64(Float64(x * x) - Float64(Float64(-4.0 * Float64(t * y)) + Float64(4.0 * Float64(z * Float64(y * z)))));
	else
		tmp = Float64(t * Float64(y * 4.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((x * x) + ((y * 4.0) * (t - (z * z)))) <= Inf)
		tmp = (x * x) - ((-4.0 * (t * y)) + (4.0 * (z * (y * z))));
	else
		tmp = t * (y * 4.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(x * x), $MachinePrecision] - N[(N[(-4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision] + N[(4.0 * N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\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 - \left(-4 \cdot \left(t \cdot y\right) + 4 \cdot \left(z \cdot \left(y \cdot z\right)\right)\right)\\

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


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

    1. Initial program 96.5%

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

      \[\leadsto x \cdot x - \color{blue}{\left(-4 \cdot \left(t \cdot y\right) + 4 \cdot \left(y \cdot {z}^{2}\right)\right)} \]
    3. Step-by-step derivation
      1. add-cube-cbrt95.5%

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

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

      \[\leadsto x \cdot x - \left(-4 \cdot \left(t \cdot y\right) + 4 \cdot \color{blue}{{\left(\sqrt[3]{y \cdot {z}^{2}}\right)}^{3}}\right) \]
    5. Step-by-step derivation
      1. rem-cube-cbrt95.6%

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

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

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

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

    if +inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y 4) (-.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. Taylor expanded in z around 0 23.1%

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

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

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

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

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

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

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

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

    \[\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 - \left(-4 \cdot \left(t \cdot y\right) + 4 \cdot \left(z \cdot \left(y \cdot z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \end{array} \]

Alternative 3: 91.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\ \mathbf{if}\;t_1 \leq \infty:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ (* x x) (* (* y 4.0) (- t (* z z))))))
   (if (<= t_1 INFINITY) t_1 (* t (* y 4.0)))))
double code(double x, double y, double z, double t) {
	double t_1 = (x * x) + ((y * 4.0) * (t - (z * z)));
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = t * (y * 4.0);
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (x * x) + ((y * 4.0) * (t - (z * z)));
	double tmp;
	if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = t * (y * 4.0);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x * x) + ((y * 4.0) * (t - (z * z)))
	tmp = 0
	if t_1 <= math.inf:
		tmp = t_1
	else:
		tmp = t * (y * 4.0)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z))))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(t * Float64(y * 4.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x * x) + ((y * 4.0) * (t - (z * z)));
	tmp = 0.0;
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = t * (y * 4.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


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

    1. Initial program 96.5%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]

    if +inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y 4) (-.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. Taylor expanded in z around 0 23.1%

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

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

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

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

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

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

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

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

    \[\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 + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \end{array} \]

Alternative 4: 66.5% accurate, 1.4× speedup?

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

\\
x \cdot x - -4 \cdot \left(t \cdot y\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. Taylor expanded in z around 0 71.1%

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

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

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

    \[\leadsto x \cdot x - -4 \cdot \left(t \cdot y\right) \]

Alternative 5: 6.2% accurate, 2.6× speedup?

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

\\
-4 \cdot \left(t \cdot y\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. Taylor expanded in t around inf 33.2%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{-4 \cdot \left(y \cdot t\right)} \cdot \sqrt{-4 \cdot \left(y \cdot t\right)}} \]
    10. add-sqr-sqrt6.7%

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot t\right)} \]
    11. expm1-log1p-u6.5%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(-4 \cdot \left(y \cdot t\right)\right)\right)} \]
    12. expm1-udef6.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-4 \cdot \left(y \cdot t\right)\right)} - 1} \]
    13. *-commutative6.6%

      \[\leadsto e^{\mathsf{log1p}\left(-4 \cdot \color{blue}{\left(t \cdot y\right)}\right)} - 1 \]
    14. associate-*r*6.6%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(-4 \cdot t\right) \cdot y}\right)} - 1 \]
    15. *-commutative6.6%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{y \cdot \left(-4 \cdot t\right)}\right)} - 1 \]
  6. Applied egg-rr6.6%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot \left(-4 \cdot t\right)\right)} - 1} \]
  7. Step-by-step derivation
    1. expm1-def6.5%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(y \cdot \left(-4 \cdot t\right)\right)\right)} \]
    2. expm1-log1p6.7%

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

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

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

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

    \[\leadsto -4 \cdot \left(t \cdot y\right) \]

Alternative 6: 31.3% accurate, 2.6× speedup?

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

\\
y \cdot \left(t \cdot 4\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. Taylor expanded in t around inf 33.2%

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

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

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

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

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

    \[\leadsto y \cdot \left(t \cdot 4\right) \]

Alternative 7: 31.3% accurate, 2.6× speedup?

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

\\
t \cdot \left(y \cdot 4\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. Taylor expanded in z around 0 71.1%

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

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

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

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

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

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

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

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

    \[\leadsto t \cdot \left(y \cdot 4\right) \]

Developer target: 90.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 2023326 
(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))))