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

Percentage Accurate: 91.2% → 96.5%
Time: 9.1s
Alternatives: 8
Speedup: 0.7×

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.2% 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 \cdot 10^{+109}:\\ \;\;\;\;\mathsf{fma}\left(y \cdot 4, \mathsf{fma}\left(z_m, -z_m, t\right), x \cdot x\right)\\ \mathbf{elif}\;z_m \leq 7.2 \cdot 10^{+251}:\\ \;\;\;\;x \cdot x - z_m \cdot \left(z_m \cdot \left(y \cdot 4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, x, \left(z_m \cdot z_m - t\right) \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 2e+109)
   (fma (* y 4.0) (fma z_m (- z_m) t) (* x x))
   (if (<= z_m 7.2e+251)
     (- (* x x) (* z_m (* z_m (* y 4.0))))
     (fma x x (* (- (* z_m z_m) t) (* y -4.0))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if (z_m <= 2e+109) {
		tmp = fma((y * 4.0), fma(z_m, -z_m, t), (x * x));
	} else if (z_m <= 7.2e+251) {
		tmp = (x * x) - (z_m * (z_m * (y * 4.0)));
	} else {
		tmp = fma(x, x, (((z_m * z_m) - t) * (y * -4.0)));
	}
	return tmp;
}
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (z_m <= 2e+109)
		tmp = fma(Float64(y * 4.0), fma(z_m, Float64(-z_m), t), Float64(x * x));
	elseif (z_m <= 7.2e+251)
		tmp = Float64(Float64(x * x) - Float64(z_m * Float64(z_m * Float64(y * 4.0))));
	else
		tmp = fma(x, x, Float64(Float64(Float64(z_m * z_m) - t) * 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, 2e+109], N[(N[(y * 4.0), $MachinePrecision] * N[(z$95$m * (-z$95$m) + t), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 7.2e+251], N[(N[(x * x), $MachinePrecision] - N[(z$95$m * N[(z$95$m * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x + N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|

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

\mathbf{elif}\;z_m \leq 7.2 \cdot 10^{+251}:\\
\;\;\;\;x \cdot x - z_m \cdot \left(z_m \cdot \left(y \cdot 4\right)\right)\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 2: 96.2% accurate, 0.1× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z_m \leq 1.75 \cdot 10^{+109} \lor \neg \left(z_m \leq 4.4 \cdot 10^{+251}\right):\\ \;\;\;\;\mathsf{fma}\left(x, x, \left(z_m \cdot z_m - t\right) \cdot \left(y \cdot -4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - 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 (or (<= z_m 1.75e+109) (not (<= z_m 4.4e+251)))
   (fma x x (* (- (* z_m z_m) t) (* y -4.0)))
   (- (* 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 <= 1.75e+109) || !(z_m <= 4.4e+251)) {
		tmp = fma(x, x, (((z_m * z_m) - t) * (y * -4.0)));
	} else {
		tmp = (x * x) - (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 <= 1.75e+109) || !(z_m <= 4.4e+251))
		tmp = fma(x, x, Float64(Float64(Float64(z_m * z_m) - t) * Float64(y * -4.0)));
	else
		tmp = Float64(Float64(x * x) - 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[Or[LessEqual[z$95$m, 1.75e+109], N[Not[LessEqual[z$95$m, 4.4e+251]], $MachinePrecision]], N[(x * x + N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z$95$m * N[(z$95$m * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
\mathbf{if}\;z_m \leq 1.75 \cdot 10^{+109} \lor \neg \left(z_m \leq 4.4 \cdot 10^{+251}\right):\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z_m \cdot z_m - t\right) \cdot \left(y \cdot -4\right)\right)\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 3: 95.7% accurate, 0.1× speedup?

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

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

\mathbf{elif}\;z_m \leq 1.12 \cdot 10^{+252}:\\
\;\;\;\;x \cdot x - z_m \cdot \left(z_m \cdot \left(y \cdot 4\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(y \cdot -4\right) \cdot {z_m}^{2}\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 4: 95.0% accurate, 0.7× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z_m \cdot z_m - t \leq 5 \cdot 10^{+280}:\\ \;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z_m \cdot z_m\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - 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) t) 5e+280)
   (+ (* x x) (* (* 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 * z_m) - t) <= 5e+280) {
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	} else {
		tmp = (x * x) - (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) - t) <= 5d+280) then
        tmp = (x * x) + ((y * 4.0d0) * (t - (z_m * z_m)))
    else
        tmp = (x * x) - (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) - t) <= 5e+280) {
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	} else {
		tmp = (x * x) - (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) - t) <= 5e+280:
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)))
	else:
		tmp = (x * x) - (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(Float64(z_m * z_m) - t) <= 5e+280)
		tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z_m * z_m))));
	else
		tmp = Float64(Float64(x * x) - 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) - t) <= 5e+280)
		tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
	else
		tmp = (x * x) - (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[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision], 5e+280], 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[(z$95$m * N[(z$95$m * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 5: 90.2% accurate, 1.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z_m \leq 1550:\\ \;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - 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 1550.0)
   (- (* x x) (* y (* t -4.0)))
   (- (* 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 <= 1550.0) {
		tmp = (x * x) - (y * (t * -4.0));
	} else {
		tmp = (x * x) - (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 <= 1550.0d0) then
        tmp = (x * x) - (y * (t * (-4.0d0)))
    else
        tmp = (x * x) - (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 <= 1550.0) {
		tmp = (x * x) - (y * (t * -4.0));
	} else {
		tmp = (x * x) - (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 <= 1550.0:
		tmp = (x * x) - (y * (t * -4.0))
	else:
		tmp = (x * x) - (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 <= 1550.0)
		tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0)));
	else
		tmp = Float64(Float64(x * x) - 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 <= 1550.0)
		tmp = (x * x) - (y * (t * -4.0));
	else
		tmp = (x * x) - (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[z$95$m, 1550.0], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z$95$m * N[(z$95$m * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
\mathbf{if}\;z_m \leq 1550:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 6: 67.9% 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
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 7: 32.2% accurate, 1.8× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;z_m \leq 7.5 \cdot 10^{+112}:\\ \;\;\;\;4 \cdot \left(y \cdot t\right)\\ \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 7.5e+112) (* 4.0 (* y 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 <= 7.5e+112) {
		tmp = 4.0 * (y * 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 <= 7.5d+112) then
        tmp = 4.0d0 * (y * 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 <= 7.5e+112) {
		tmp = 4.0 * (y * 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 <= 7.5e+112:
		tmp = 4.0 * (y * 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 <= 7.5e+112)
		tmp = Float64(4.0 * Float64(y * 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 <= 7.5e+112)
		tmp = 4.0 * (y * 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, 7.5e+112], N[(4.0 * N[(y * t), $MachinePrecision]), $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 7.5 \cdot 10^{+112}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. 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
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Developer target: 91.2% 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 2023342 
(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))))